如何删除从postDelayed增加了一个处理程序对象可运行?增加了、对象、程序、postDelayed

2023-09-04 10:50:09 作者:女生酷酷的,酷一点的女生

我有一个开放式的动画和正在使用Handler.postDelayed(Runnable接口,延迟)触发短暂的延迟后,关闭动画。然而,在之间打开和关闭的时间,有可能是另一个动画由点击触发的......我的问题是,我怎么会在处理程序中取消关闭动画?

I have an "open" animation and am using Handler.postDelayed(Runnable, delay) to trigger a "close" animation after a short delay. However, during the time between open and close, there is possibly another animation triggered by a click...my question is, how would I cancel the "close" animation in the handler?

感谢

推荐答案

只需使用removeCallbacks(Runnable R) 的方法。

Just use the removeCallbacks(Runnable r) method.