返回真假OnTouch? [英] Returning true and false in OnTouch?

查看:214
本文介绍了返回真假OnTouch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它的问题,如果我回到 onTouch()的 OnTouchListener ? 我看不到回有什么区别在这个例子中:Android上滑动列表

Does it matter if i return true or false in onTouch() of an OnTouchListener? I can't see any difference between returning true or false in this example: Android Swipe on List

推荐答案

返回值决定,如果你消耗的触摸事件。

The return value determines if you consumed the touch event.

在换句话说意味着这个触摸事件有趣的是,你都遵循了这个触摸事件类似的电话 ACTION_MOVE ACTION_UP 将被发送给您。

In other words true means that this touch event is interesting to you and all follow up calls of this touch event like ACTION_MOVE or ACTION_UP will be delivered to you.

如果您返回比触摸事件将被传递到下一个查看进一步在视图层次您将收到任何来电跟进。触摸事件将继续向上视图层次进一步传递,直到有人占用了。

If you return false than the touch event will be passed to the next View further up in the view hierarchy and you will receive no follow up calls. The touch event will continue to be passed further up the view hierarchy until someone consumes it.

如果您有任何问题,请随时问!

If you have any further questions please feel free to ask!

这篇关于返回真假OnTouch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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