美文网首页Android Utils
Android 中 OnTouch 的返回值

Android 中 OnTouch 的返回值

作者: 几千里也 | 来源:发表于2017-02-09 14:00 被阅读49次

Q: 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

A: The return value determines if you consumed the touch event.
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 then 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.

相关文章

网友评论

    本文标题:Android 中 OnTouch 的返回值

    本文链接:https://www.haomeiwen.com/subject/msxpqttx.html