简体   繁体   English

如果ACTION_UP取消动画

[英]Cancel animation if ACTION_UP

I have onTouchListener on my gridView and if ACTION_DOWN is pressed the animation(scale) starts. 我在gridView上具有onTouchListener,如果按下ACTION_DOWN,则动画(缩放)开始。 How do following things: 如何做以下事情:

  1. How to hold scaled image if it's ACTION_DOWN pressed 如果按下ACTION_DOWN,如何保存缩放后的图像
  2. If is ACTION_DOWN animation is started but then if ACTION_UP (if animation is not complete) animation is instantly gone (back to time before animation start) 如果是ACTION_DOWN动画开始,但是如果ACTION_UP(如果动画不完整),动画立即消失(返回动画开始之前的时间)

In order to get the Animation's final state to stick after it is complete, you need to call Animation.setFillAfter(true) 为了使动画的最终状态在完成后保持不变,您需要调用Animation.setFillAfter(true)

You can reset a running animation at any time with Animation.cancel() and Animation.reset() to put the view transformation back to its initial state. 您可以随时使用Animation.cancel()Animation.reset()重置正在运行的动画,以将视图转换恢复为其初始状态。

HTH 高温超导

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM