Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在ImageView中清除带有延迟的动画_Android_Android Animation - Fatal编程技术网

Android 在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

我的代码中有一个动画。但我想当我点击按钮时,我的ImageView返回到原始位置(重置动画),我有一个方法。我的代码是:

 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才能使返回动画正常工作