Я определил круговой индикатор выполнения, используя следующую вытачиваемую "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>
и я использовал этот drawable для ProgressBar
в своем макете, используя следующий код
<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, но не повезло. Есть ли способ запустить угол развертки сверху?