1.项目上一个简单需求,一个自旋转的imageview。
动画效果的代码:
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.img_animation);
LinearInterpolator interPolator = new LinearInterpolator();// 设置动画匀速运动
animation.setInterpolator(interPolator);
imgWorld.startAnimation(animation);
对应的R.anim.img_animation的代码
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<rotate
android:duration="5000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="-1"
android:repeatMode="restart"
android:toDegrees="360&