首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >半圆进度条Android -绘图半圆

半圆进度条Android -绘图半圆
EN

Stack Overflow用户
提问于 2015-01-06 10:31:38
回答 3查看 6.8K关注 0票数 3

我使用这个慢吞吞\循环devadvance创建了一个半圆形进度条,当我从调色板中选择那个自定义视图时,它看起来是这样的。

在这里,我有两个相对的布局与重量。包含进度条的布局的权重为2,底部的权重为3,并将进度条的布局宽度和高度设置为包装内容。

所以我的问题是为什么当从调色板中选择的时候进度条看起来是这样的呢?是因为画布的尺寸有完美的方格吗?我想要的是半圆形进度条完全被这样的布局所包围。

任何关于这方面的灯光都是非常感谢的。

编辑 xml代码

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main_parent_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:fitsSystemWindows="true">

    <include layout="@layout/toolbar"/>

    <android.support.v4.widget.DrawerLayout
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="3">

        <LinearLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <RelativeLayout xmlns:app = "http://schemas.android.com/apk/res-auto"
                android:id ="@+id/calorie_frame"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="2"
                android:clickable="true">
                <com.devadvance.circularseekbar.CircularSeekBar
                    android:id="@+id/calorie_progressbar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:start_angle = "180"
                    app:end_angle = "0"
                    app:progress = "25"
                    app:circle_x_radius="200"
                    app:circle_y_radius="200"
                    app:circle_stroke_width = "30"
                    app:use_custom_radii="true"
                    app:circle_color ="#FFFACD"

                    android:layout_alignParentEnd="false"
                    android:layout_alignParentStart="false"
                    android:layout_centerInParent="true" />
                </RelativeLayout>

            <RelativeLayout
                android:id="@+id/exercise_frame"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:clickable="true">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="@string/calorie_label"
                    android:id="@+id/textView"
                    android:layout_marginBottom="40dp"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentEnd="true"
                    android:layout_marginRight="20dp" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/imageView"
                    android:layout_alignBottom="@+id/textView"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_marginLeft="50dp"
                    android:layout_marginStart="50dp"
                    android:contentDescription="@string/exercise_image" />

            </RelativeLayout>
        </LinearLayout>

        <ListView
            android:id="@+id/left_drawer"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:choiceMode="singleChoice"
            android:divider="@android:color/transparent"
            android:dividerHeight="0dp"
            android:background="#999"/>
    </android.support.v4.widget.DrawerLayout>

</LinearLayout>

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2015-12-13 23:01:22

问题是你的帆布高度。你有一个圆的高度,你在上面画了一半的圆圈。试试这个:ArcProgressBar --它有您需要的东西,您可以很容易地根据您的需要定制https://github.com/natasam/DemoProgressViewsLibApp。高度是弧形的高度,而不是像你这样的完整的圆。你也可以设置填充,边距,宽度,你想要的。

票数 -1
EN

Stack Overflow用户

发布于 2015-01-06 11:16:00

加上这个

代码语言:javascript
运行
复制
android:layout_height="0dp"

对此

代码语言:javascript
运行
复制
android:layout_height="match_parent" 

用于添加权重属性的相对布局。

代码语言:javascript
运行
复制
android:id="@+id/exercise_frame"   
android:id ="@+id/calorie_frame"

ids更改height="0dp"

希望它能成功..。

票数 0
EN

Stack Overflow用户

发布于 2015-01-15 06:28:40

我仍然没有找到发生的原因,如所示,但我的猜测是,它应该是那样的工作。无论如何,我用这个lzyzsd/循环进展替换了它,它对于我的用例来说非常好。

类似的令人敬畏的东西可以在这里找到安卓-武器库

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27796721

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档