<ProgressBar android:id="@+id/pb_load" android:layout_width="@dimen/dp_24" android:layout_height="@dimen/dp_24" style="?android:attr/progressBarStyle" android:indeterminateBehavior="repeat" android:indeterminateDrawable="@drawable/progressbar2" android:indeterminateDuration="2000" android:layout_centerInParent="true"/>
一
<?xml version="1.0" encoding="utf-8"?> <animated-rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="720" android:drawable="@drawable/ic_cloud_loading_circle" android:interpolator="@android:anim/linear_interpolator" android:repeatCount="-1" android:duration="20000" > </animated-rotate>
二
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="720" android:drawable="@drawable/ic_cloud_loading_circle" android:interpolator="@android:anim/linear_interpolator" android:repeatCount="-1" android:duration="20000" > </rotate>
一 和 二的写法区别,一就是转菊花效果,能控制时间,用indeterminateDuration,二 就是转圈,能控制时间,用indeterminateDuration。
一和二 内部属性 duration repeatCount 均失效。
要想转菊花,让UI切好图,不然用一的效果动起来怪怪的 。