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

后端 未结 7 1021
轮回少年
轮回少年 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:37

    Use the method setAnimation(null) to stop an animation, it exposed as public method in View.java, it is the base class for all widgets, which are used to create interactive UI components (buttons, text fields, etc.). /** * Sets the next animation to play for this view. * If you want the animation to play immediately, use * {@link #startAnimation(android.view.animation.Animation)} instead. * This method provides allows fine-grained * control over the start time and invalidation, but you * must make sure that 1) the animation has a start time set, and * 2) the view's parent (which controls animations on its children) * will be invalidated when the animation is supposed to * start. * * @param animation The next animation, or null. */ public void setAnimation(Animation animation)

    0 讨论(0)
提交回复
热议问题