今天做个小需求,需要不间断的旋转,先上代码再解释:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="800"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="-1"
android:fillAfter="true"
android:toDegrees="360" />
android:interpolator="@android:anim/linear_interpolator"
无限旋转
android:repeatCount="-1"
旋转一圈的时间:
android:duration="800"
从0度旋转到360度,即旋转一圈
android:fromDegrees="0"
<pre name="code" class="html">android:toDegrees="360"
以图片中心为原点旋转:
android:pivotX="50%"
android:pivotY="50%"