I need to disable touch gesture on the scrim (the red highlighted part). I want to dismiss the drawer only with the swipe.
The issue is that when the drawer layout is open and I need to select an element from the ListView below the red highlighted part, what's happend is that the drawer get closed and only at this point I can select an element from the ListView.
I need to select the element from the ListView directly, also when the Drawer is opened
You have to create custom drawer for that like this
Note :
getChildAt(1)
should be that child to whom you have given gravity as "start" and whose width determines the width of opening drawer.I hope this should solve your problem
just add
android:clickable="true"
to drawer menu.I asked an answered a question here:
How to vary between child and parent view group touch events
The
parent
(drawer
)ontouchevent
is being fired, rather than thechild
,listview
.I have also answered a similar problem here:
https://stackoverflow.com/a/28180281/3956566
You need to manage your touch events so it is handled by the child. You need to use an
onInterceptTouchEvent
and return false.You then manage you
touchevent
for the list view:You can also determine what type of touch event is taking place eg, scrolling and determine whether the child or parent will manage the event.
Managing Touch Events in a ViewGroup
I've added this quote from here Understanding Android Input Touch Events System Framework (dispatchTouchEvent, onInterceptTouchEvent, onTouchEvent, OnTouchListener.onTouch):
With this diagram:
Let me know if you need more explanation.