如何删除从postDelayed增加了一个处理程序对象可运行? [英] How to remove a runnable from a handler object added by postDelayed?

查看:204
本文介绍了如何删除从postDelayed增加了一个处理程序对象可运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开放式的动画和正在使用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?

感谢

推荐答案

只需使用<一个href="http://developer.android.com/reference/android/os/Handler.html#removeCallbacks%28java.lang.Runnable%29"><$c$c>removeCallbacks(Runnable R) 的方法。

Just use the removeCallbacks(Runnable r) method.

这篇关于如何删除从postDelayed增加了一个处理程序对象可运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆