我有一个自定义的圆形进度栏。这是我要确定的可绘制对象:

<?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>

我希望它显示顺时针方向的进度,但是现在它显示逆时针方向。

我该如何更改?

最佳答案

我猜您正在使用rtl语言?您可以通过在layoutDirection上设置ProgressBar属性,将进度条强制为ltr或顺时针方向。

<ProgressBar
    ...
    android:layoutDirection="ltr" />

关于Android自定义圆形ProgressBar方向,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44884317/

10-11 22:54
查看更多