Android自定义循环ProgressBar方向

ami*_*ros 6 android android-layout android-progressbar layer-list

我有一个自定义循环进度条.这是我可以确定的可绘制的:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@android:id/secondaryProgress">
    <shape
        android:innerRadiusRatio="6"
        android:shape="ring"
        android:thicknessRatio="20.0"
        android:useLevel="true">
     <gradient
          android:centerColor="#999999"
          android:endColor="#999999"
          android:startColor="#999999"
          android:type="sweep" />
    </shape>
  </item>
  <item android:id="@android:id/progress">
   <rotate
      android:fromDegrees="270"
      android:pivotX="50%"
      android:pivotY="50%"
      android:toDegrees="270">

  <shape
      android:innerRadiusRatio="6"
      android:shape="ring"
      android:thicknessRatio="20.0"
      android:useLevel="true">


    <rotate
        android:fromDegrees="360"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toDegrees="0" />

    <gradient
        android:centerColor="?attr/colorAccent"
        android:endColor="?attr/colorAccent"
        android:startColor="?attr/colorAccent"
        android:type="sweep" />

      </shape>
    </rotate>
  </item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)

我希望它以顺时针方向显示进度,但现在它显示逆时针方向.

我该如何改变它?

tac*_*lux 8

我猜你用的是rtl语言?您可以通过layoutDirection在您的上设置属性来强制进度条为ltr或顺时针方向ProgressBar.

<ProgressBar
    ...
    android:layoutDirection="ltr" />
Run Code Online (Sandbox Code Playgroud)