Android 如何以25度增量旋转图像?安卓动画
我有这个用于动画的xml代码。我需要图像每半秒旋转25度。 但图像旋转360度并停止。我做错了什么 我的任务是制作一个旋转加载图像。也许可以用另一种方式来做Android 如何以25度增量旋转图像?安卓动画,android,android-animation,Android,Android Animation,我有这个用于动画的xml代码。我需要图像每半秒旋转25度。 但图像旋转360度并停止。我做错了什么 我的任务是制作一个旋转加载图像。也许可以用另一种方式来做 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <rotat
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:duration="100"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
android:toDegrees="24" />
<rotate
android:duration="100"
android:fromDegrees="24"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
android:toDegrees="48" />
<rotate
android:duration="100"
android:fromDegrees="48"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
android:toDegrees="72" />
<rotate
android:duration="100"
android:fromDegrees="72"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
android:toDegrees="96" />
// and many more "rotate" up to android:toDegrees="360"
</set>
//还有更多的“旋转”到android:toDegrees=“360”
如果图像必须每半秒旋转25度才能旋转360度,则需要7200毫秒。所以你可以试试这种方法
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<rotate
android:duration="7200"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:startOffset="0"
android:toDegrees="360" />
</set>
它们都有相同的startOffset,是不是应该增加?startOffset是显示抽搐的必要条件,但不起作用。这将是一个平稳的转折。我想让它像时钟一样移动,抽搐。