In my android app I try to implement my own progressbar like in some other apps. So if my customer click on a button the the refresh image is replaced with a rotating circle. But my circle is not rotating.
I add my rotating circle in the xml layout to test the rotating xml.
<ImageView android:layout_gravity="center_vertical" android:contentDescription="@string/liga" android:layout_height="40dp" android:layout_width="40dp" android:clickable="true" android:id="@+id/iv_refresh" android:src="@drawable/progress_medium_holo" ></ImageView>
This ist my rotating xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:drawable="@drawable/spinner_48_outer_holo"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="1080" />
</item>
<item>
<rotate
android:drawable="@drawable/spinner_48_inner_holo"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="720"
android:toDegrees="0" />
</item>
</layer-list>
I had a similar problem and did not really understand baeckerman83 solution. After poking around in the source code it seems the Progress bar animates its drawables with setLevel. If you are still adamant on using the progressbar heres what I did: