Pass touches to the view under Pass touches to the view under android android

Pass touches to the view under


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


simplest way :

form here: http://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: To achieve this, you have to add a click to its direct parent. or set android:clickable="false" andandroid:focusable="false" to its direct parent to pass listener tofurther parent.


You can use special flag in layoutParams.

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

WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE