Normally when pressing on the content area of the DrawerLayout
, the drawer will close and the touch is consumed. Is there a way to prevent this and pass the touch event on to the content area?
Thanks!
Normally when pressing on the content area of the DrawerLayout
, the drawer will close and the touch is consumed. Is there a way to prevent this and pass the touch event on to the content area?
Thanks!
Inspired by the answer given by guy_m, I adapted his proposals and suggest the following extension of DrawerLayout. Again, this solution is by overriding onInterceptTouchEvent().
The logic of the overriding method is fairly simple:
The following example of an overridden onInterceptTouchEvent() method is for a DrawerLayout whose drawer view is located on the right of the screen (android:gravity="right"). However, it should be obvious how to adapt the code to work for a standard left-placed drawer view as well.
I ended up modifing DrawerLayout.
In the method
onInterceptTouchEvent(MotionEvent ev)
you'll have to preventinterceptForTap
being set to true. One way is to remove the following conditional.That will allow touches to "fall through".
To have the drawer not close you can set the drawer lock mode to
LOCK_MODE_LOCKED_OPEN
.