Android 中 OnTouch 的返回值

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.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容