android - Drawer Layout takes the touch event instead of navigation pane's elements -
my android project contains 2 navigation drawers. 1 right side, other left. open click of button using this:
if (mdrawerlayout.isdraweropen(mrightdrawerview)) mdrawerlayout.closedrawer(mrightdrawerview); mdrawerlayout.opendrawer(mleftdrawerview); both drawers have custom layouts in them, defined using:
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" /> <include android:id="@+id/left_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" layout="@layout/menu_panel" /> <include android:id="@+id/right_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="end" layout="@layout/search_panel" /> </android.support.v4.widget.drawerlayout> the problem is: when open drawer , try capture click event, (there buttons , textviews in drawer layout) the drawer closes instead of responding click events.
i have used:
mdrawerlayout.setdrawerlockmode(drawerlayout.lock_mode_locked_closed); mdrawerlayout.requestdisallowintercepttouchevent(true); i not want drawer close on touch event inside it.
i have tried changing "clickable" attribute of drawer layout. no use.
any highly appreciated. thanks
might late answer question , it'll others , facing same problem you..
set clickable 'true' included layouts i.e left , right drawer. clickable event consumes touch.
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" /> <include android:id="@+id/left_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" android:clickable="true" layout="@layout/menu_panel" /> <include android:id="@+id/right_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="end" android:clickable="true" layout="@layout/search_panel" /> </android.support.v4.widget.drawerlayout>
Comments
Post a Comment