如何使用xml或代码将圆形进度条划分为多个部分?

时间:2018-08-17 08:04:41

标签: android xml android-layout android-progressbar

我创建了自定义进度栏:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="ring"
        android:innerRadiusRatio="3"
        android:thickness="10dp"
        android:useLevel="false">

        <solid android:color="@color/lightGrey" />
    </shape>
</item>
<item>
    <rotate
        android:fromDegrees="270"
        android:toDegrees="270">
        <shape
            android:innerRadiusRatio="3"
            android:shape="ring"
            android:thickness="10dp"
            android:useLevel="false">

            <gradient
                android:angle="0"
                android:startColor="@color/grey"
                android:endColor="@color/red"
                android:type="sweep"
                android:useLevel="false" />
        </shape>
    </rotate>
</item>

所以结果是:

now

但我想将其分为以下部分:

requested result

如何使用xml或使用画布进行绘制?我必须将部分放在特定的位置

0 个答案:

没有答案