Pass touches to the view under

此生再无相见时 提交于 2019-11-29 05:25:31
Maciej Boguta

In your overriden onTouchEvent method inside the fragment return false, it passes the touch event to the lower layer views.

mhdjazmati

simplest way :

from here : https://stackoverflow.com/a/34436589/3818437

Declare your fragment not clickable / focusable by using

android:clickable="false"
android:focusable="false"

or

v.setClickable(false)
v.setFocusable(false).

The click events should be dispatched to the fragment's parent now.

Note: In order to achieve this, you have to add click to its direct parent. or set android:clickable="false" and android:focusable="false" to its direct parent to pass listener to further parent.

You can use special flag in layoutParams.

(https://stackoverflow.com/a/53955777/2885859)

WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!