我希望在不使用xml代码动画的情况下平滑地旋转图像(在每个旋转周期不小停止)。
与xml动画中的linear_interpolator
类似。
这是我的旋转代码:
RotateAnimation animRotate;
AnimationSet animSet;
animSet = new AnimationSet(true);
animSet.setInterpolator(new DecelerateInterpolator());
animSet.setFillAfter(true);
animSet.setFillEnabled(true);
final RotateAnimation animRotate = new RotateAnimation(0.0f,360.0f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
animRotate.setDuration(10000);
animRotate.setFillAfter(true);
animSet.addAnimation(animRotate);
animSet.setRepeatCount(-1);
img.startAnimation(animRotate);
//at timer
if (animRotate.hasEnded()) {
img.startAnimation(animRotate);
}