我正在尝试开发我的第一个 Android 应用程序。我读了很多关于动画的文章。现在我的布局上有一个 ImageView,我想将它旋转 360 度。这个动画永远重复。所以这是我的 solteypanim.xml 文件:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:ordering="sequentially" >
<objectAnimator
android:duration="3000"
android:propertyName="rotation"
android:repeatCount="infinite"
android:valueTo="360"
android:valueFrom="0" />
</set>
这是我的活动代码
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState) {
...
ImageView solTeyp = (ImageView)findViewById(R.id.solTeyp);
AnimatorSet solTeypAnim = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.solteypanim);
solTeypAnim.setTarget(solTeyp);
solTeypAnim.start();
...
}
它工作但有一个问题。旋转值的变化不是线性的。我的意思是在动画的开始和结束时有一个缓动效果。它开始缓慢,然后加快速度,然后降低速度。每一回合都有同样的问题。
你能告诉我如何禁用这种缓动效果吗?