我想旋转我的ImageView 2次
最初它将旋转360度,然后再旋转一些。
我正在使用以下代码
protected void rotation(int start, int end, int time) {
Animation a = new RotateAnimation((float)start, (float)end,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
a.setDuration((long)time);
a.setInterpolator(new LinearInterpolator());
a.setFillAfter(true);
ImageView.startAnimation(a);
}
我的问题是我两次调用此函数,所以它不等待第一个而直接开始第二个旋转。
我想等到第一次旋转完成,然后再开始第二次旋转
在第一个动画中设置侦听器
a.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
callNewAnimation();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句