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

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

    You must use .clearAnimation(); method in UI thread:

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            v.clearAnimation();
        }
    });
    

提交回复
热议问题