Reputation: 2967
I have a custom Circular Progressbar. This is the drawable I have for it to be determinate:
<?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>
I want it to show the progress in a clockwise direction, but now it's showing counterclockwise.
How do I change it?
Upvotes: 9
Views: 4967
Reputation: 289
you can change rotation on Y axis by 180 degrees
android:rotationY="180"
Upvotes: 0
Reputation: 24472
By using latest versions of material design library, you can achieve this:
app:indicatorDirectionCircular
setIndicatorDirection()
Refer here for more info.
Upvotes: 2
Reputation: 20211
I guess you're using an rtl language? You can force the progress bar to an ltr or clockwise direction by setting the layoutDirection
property on your ProgressBar
.
<ProgressBar
...
android:layoutDirection="ltr" />
Upvotes: 20
Reputation: 3200
I'm not sure if it will work, but just try to set android:toDegrees="-360"
like this :
<rotate
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="-360" />
Upvotes: 0
Reputation: 643
Change this
<rotate
android:fromDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0" />
to
<rotate
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" />
Upvotes: 0