【发布时间】:2010-12-10 16:38:13
【问题描述】:
我正在使用RotateAnimation 来旋转我在 Android 中用作自定义循环微调器的图像。这是我的rotate_indefinitely.xml 文件,我将它放在res/anim/:
<?xml version="1.0" encoding="UTF-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:duration="1200" />
当我使用AndroidUtils.loadAnimation() 将它应用到我的ImageView 时,效果很好!
spinner.startAnimation(
AnimationUtils.loadAnimation(activity, R.anim.rotate_indefinitely) );
一个问题是图像旋转似乎在每个周期的顶部暂停。
换句话说,图像旋转 360 度,短暂暂停,然后再次旋转 360 度,等等。
我怀疑问题在于动画使用了默认插值器,例如 android:iterpolator="@android:anim/accelerate_interpolator" (AccelerateInterpolator),但我不知道如何告诉它不要插值动画。
如何关闭插值(如果这确实是问题)以使我的动画循环顺畅?
【问题讨论】: