0

最近几天在android中工作,我试图通过按下按钮来旋转箭头。使用 RotateAnimation 和:

setFillAfter(true);

箭头按预期保持在最后一个位置。但是当我再次按下按钮时,箭头是开始从初始位置旋转,但是最后一次动画调用中的“上一个”箭头最终被“新”箭头重叠。所以我想我需要以某种方式重置/清除 setFillAfter 但我找不到方法。

我的代码是这样的:

//Animation start
float Xaxis=0.835366f;
float Yaxis=0.676692f;
RotateAnimation rotateAnimation1 = new RotateAnimation(0, 180,
    Animation.RELATIVE_TO_SELF, Xaxis,Animation.RELATIVE_TO_SELF, Yaxis);
rotateAnimation1.setInterpolator(new LinearInterpolator());
rotateAnimation1.setDuration(2500);
rotateAnimation1.setRepeatCount(0);
image.startAnimation(rotateAnimation1);
rotateAnimation1.setAnimationListener(this);

@Override
public void onAnimationEnd(Animation animation) {
    animation.setFillAfter(true);
}

任何想法都会很有用..我尝试过无效,clearAnimation 到图像,将 fillafter 设置为 false,重置动画但仍然相同。

4

1 回答 1

0

它是固定的,模拟器配置了共享 GPU 并且运行完美。快速且没有任何先前动画的残留。

于 2013-03-08T12:17:45.417 回答