废话不多说, 上图:
效果: 一直不停的顺时针旋转.gif
动画xml文件
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!--
效果: 一直不停的顺时针旋转
android:toDegrees="359" 0~359防止卡顿
android:pivotX="50%" 设置旋转中心点为控件中心
android:repeatCount="-1" 设置不断旋转
-->
<rotate
android:duration="1000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="-1"
android:toDegrees="359" />
</set>
java代码: 给imageView设置动画
Animation circle_anim = AnimationUtils.loadAnimation(AnimACT.this, R.anim.anim_round_rotate);
//设置匀速旋转,在xml文件中设置会出现卡顿
LinearInterpolator interpolator = new LinearInterpolator();
circle_anim.setInterpolator(interpolator);
if (circle_anim != null) {
//开始动画
ivIcon.startAnimation(circle_anim);
}