//旋转布局
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:duration="1000"
android:pivotX="30%p"
android:pivotY="30%p"
android:repeatCount="1"
android:repeatMode="reverse"
android:fillAfter="true"
>
</rotate>
//代码
public void rotate(View view){
RotateAnimation rotateAnimation=new RotateAnimation(0,360,Animation.RELATIVE_TO_PARENT, 0.3f, Animation.RELATIVE_TO_PARENT, 0.3f);
rotateAnimation.setDuration(100);
rotateAnimation.setFillAfter(true);
rotateAnimation.setRepeatCount(Animation.INFINITE);
rotateAnimation.setRepeatMode(Animation.REVERSE);
iv.startAnimation(rotateAnimation);
iv.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate));
}