【转】Android 旋转动画,停止和持续旋转

旋转180度后停止

RotateAnimation rotate;

rotate =new RotateAnimation(0f,180f,Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f);

rotate.setDuration(1000); rotate.setFillAfter(true); image.startAnimation(rotate);

持续旋转,不停止

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false" >

    <rotate
        android:duration="2000"
        android:fromDegrees="0"
        android:interpolator="@android:anim/linear_interpolator"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="-1"
        android:repeatMode="restart"
        android:startOffset="-1"
        android:toDegrees="+360" />

</set>


rotate = AnimationUtils.loadAnimation(MychoiceActivity.this, R.anim.dialog_loading_animation);
image.startAnimation(rotate);

Android 动画之Interpolator插入器,比较简单和常用的:

(1)LinearInterpolator:动画从开始到结束,变化率是线性变化。
(2)AccelerateInterpolator:动画从开始到结束,变化率是一个加速的过程。
(3)DecelerateInterpolator:动画从开始到结束,变化率是一个减速的过程。
(4)CycleInterpolator:动画从开始到结束,变化率是循环给定次数的正弦曲线。
(5)AccelerateDecelerateInterpolator:动画从开始到结束,变化率是先加速后减速的过程。

from:http://blog.csdn.net/mimi5821741/article/details/47260505
原文地址:https://www.cnblogs.com/xuan52rock/p/6397931.html