1.ImageView实现:不要把rotate标签写在set标签里就行了
你的ImageView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate));
/anim/rotate.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:toDegrees="360">
</rotate>
2.ProgressBar实现:
/drawable/rotate.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate android:drawable="@mipmap/loading_green"
android:fromDegrees="0.0"
android:toDegrees="360.0"
android:duration="100"
android:pivotX="50.0%"
android:pivotY="50.0%" />
</item>
</layer-list>
loading_green是普通的png图片。
<ProgressBar
android:id="@+id/pb_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@drawable/rotate"
android:indeterminate="false"
android:indeterminateDuration="500"/>
旋转相关:
http://gundumw100.iteye.com/blog/1289348
http://www.cnblogs.com/xingfuzzhd/archive/2013/12/28/3495941.html