//1.----------------------------------------------------第一步 圆形图片依赖加xml布局------------------------------------------------------
//圆形图片依赖
implementation 'de.hdodenhof:circleimageview:2.1.0'
//xml布局
<de.hdodenhof.circleimageview.CircleImageView
android:src="@mipmap/ic_launcher"
android:layout_gravity="center"
android:id="@+id/imageID"
android:layout_width="100dp"
android:layout_height="100dp" />
//2.------------------------------------------------------第二步 res下创建文件夹anim,里面再创建anim的xml文件---------------------
<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" />
</set>
duration:时间
fromDegrees="0": 从几度开始转
toDegrees="360" : 旋转多少度
pivotX="50% 旋转中心距离view的左顶点为50%距离,
pivotY="50% 距离view的上边缘为50%距离
repeatCount="-1":重复次数,-1为一直重复
repeatMode="restart":重复模式,restart从头开始重复
//3.------------------------------------------------------------第三步 ----------------------------------------------------------------
//动画
animation = AnimationUtils.loadAnimation(this, R.anim.anim);
LinearInterpolator lin = new LinearInterpolator();//设置动画匀速运动
animation.setInterpolator(lin);
imageID.startAnimation(animation);
//-------------------------------------------------------------------------------完----------------------------------------------------------------------------