How to stop an animation (cancel() does not work)

后端 未结 7 1072
轮回少年
轮回少年 2020-11-29 16:52

I need to stop a running translate animation. The .cancel() method of Animation has no effect; the animation goes until the end anyway.

How

7条回答
  •  星月不相逢
    2020-11-29 17:34

    If you are using the animation listener, set v.setAnimationListener(null). Use the following code with all options.

    v.getAnimation().cancel();
    v.clearAnimation();
    animation.setAnimationListener(null);
    

提交回复
热议问题