问题描述
它的问题,如果我回到真
或假
在 onTouch()的
OnTouchListener
?我看不到回有什么区别真
或假
在这个例子中:
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!