Android 在ImageView中清除带有延迟的动画
我的代码中有一个动画。但我想当我点击按钮时,我的ImageView返回到原始位置(重置动画),我有一个方法。我的代码是:Android 在ImageView中清除带有延迟的动画,android,android-animation,Android,Android Animation,我的代码中有一个动画。但我想当我点击按钮时,我的ImageView返回到原始位置(重置动画),我有一个方法。我的代码是: private void returnToOriginalRotationState() { RotateAnimation animation = new RotateAnimation(0.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animatio
private void returnToOriginalRotationState() {
RotateAnimation animation = new RotateAnimation(0.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration((long) 2*1000);
animation.setFillAfter(true);
animation.setFillEnabled(true);
imgHeade.startAnimation() }
它也起作用
但是
动画.setDuration((长)2*1000)
不工作
安卓安卓动画这是您要执行的动画
new RotateAnimation(0.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
似乎所有的度数都是
0.0f
执行imgHeade.setAnimation(animation)代码>然后运行动画。谢谢,我使用了imgHeade.setAnimation(动画);但动画未运行是的,我想将ImageVIew置于原始位置,因为当我提示按钮ImageVIew移动到新的旋转动画(0,19,animation.RELATIVE\u to\u SELF,0,animation.RELATIVE\u to\u SELF,0);这段代码也可以使用。现在我想把我的ImageView恢复到原始位置。你需要在某个地方使用19才能使返回动画正常工作