Я определил круговой индикатор выполнения, используя следующий рисуемый "ciruclar_progress_bar.xml"
<?xml version="1.0" encoding="utf-8"?>
<item android:id="@android:id/progress">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thicknessRatio="25.0" >
<gradient
android:centerColor="@color/gray"
android:endColor="@color/gray"
android:startColor="@color/gray"
android:type="sweep" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thicknessRatio="25.0" >
<gradient
android:centerColor="@color/green"
android:endColor="@color/green"
android:startColor="@color/green"
android:type="sweep" />
</shape>
</item>
and I have used this drawable for ProgressBar
in my layout using the following code
<ProgressBar
android:id="@+id/progressWheel"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="152dp"
android:layout_height="152dp"
android:layout_centerInParent="true"
android:progress="100"
android:indeterminate="false"
android:progressDrawable="@drawable/circular_progress_bar" />
Я использовал следующий код, чтобы показать прогресс на ProgressBar
progressWheel.setSecondaryProgress(percent);
(Используется вторичный прогресс, потому что зеленый цвет должен располагаться поверх черного цвета кольца.)
Это рисует круг ProgressBar
, начальная позиция которого находится справа (0°), как показано на следующем изображении.
Я хочу, чтобы прогресс начинался сверху, как показано на следующем рисунке.
Я попытался поместить android:angle="270"
в тег градиента drawable xml, но не повезло. Есть ли способ начать угол развертки сверху?