给一个控件添加一个旋转动画



// 均匀旋转动画
private RotateAnimation rotateAnimation;



rotateAnimation = (RotateAnimation) AnimationUtils.loadAnimation(getContext(), R.anim.rotating_anim);



// 添加匀速转动动画
LinearInterpolator lir = new LinearInterpolator();
rotateAnimation.setInterpolator(lir);



ivOpen.startAnimation(rotateAnimation);


ivOpen.clearAnimation();




<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="800"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="-1"
    android:toDegrees="359" >


</rotate>

猜你喜欢

转载自blog.csdn.net/u014434239/article/details/82657040