我想制作一个可以循环的加载图片。
我试过这个:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:fromDegrees="0"
android:toDegrees="360"
android:duration="1000"
android:pivotX="50%"
android:repeatCount="infinite"
android:pivotY="50%">
</rotate>
</set>
效果很好,但我的问题是每当图像从 0 度变为 360 度时,它会停止大约 0.001 秒然后再次旋转。有什么帮助吗?
最佳答案
这是因为 0
和 360
在同一个位置试试这个:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<rotate
android:fromDegrees="0"
android:toDegrees="359"
android:duration="1000"
android:pivotX="50%"
android:repeatCount="infinite"
android:pivotY="50%">
</rotate>
</set>
关于android 动画在每次旋转后停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17588662/