Currently following is the layout of my application:
LinearLayout
----Button
----ScrollView
----RelativeLayout
----EditText
I have created one transparent LinearLayout over all of these,implemented OnTouchListener and inside OnTouch(),returned false. So, all controls are moved below childrens.But on LinearLayout, I am not able to handle ACTION_MOVE actions since MotionEvent object is not consumed by this layout. Is there any way that I can detect all touch event both in parent and child views ?
You could accomplish that by overriding
dispatchTouchEvent
in the layout.Then use that layout in place of the usual FrameLayout:
You could also skip the super call entirely if you need to prevent child views from receiving the event, but I think this would be rare.
This answer is based on the reference of Romain guy answer.