0

I had implement DrawerLayout in my application. Now if suppose I click on screen then the DrawerLayout is getting close. But now I want to implement some operations on onTouch.

My question is how can I prevent the DrawerLayout to close onTouch. I want to implement this like suppose I dismiss the onTouch event of DrawerLayout.

If any suggestion please share with me.

Thanks in advance.

anddev
  • 3,144
  • 12
  • 39
  • 70
  • 1
    in the navigation drawer sample from the developer site this `mDrawerLayout.closeDrawer(mDrawerList)` closes the drawer comment this line and your drawer will not close. You are closing the drawer on selection of an item in the drawer list. – Raghunandan Oct 02 '13 at 07:02
  • 2
    what about locking/unlocking the drawer to prevent unwanted closing? – MikeIsrael Oct 02 '13 at 07:58

1 Answers1

0

Its not actually a proper solution but is a workaround increase the drawer width so that it covers majority of the screen.Doing this your drawer will get most of the touch events and therefore wont close on touch.

<ListView
    android:id="@+id/drawerContentList"
    style="@style/Theme.AppCompat.Light.DarkActionBar"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="#111"
    android:choiceMode="singleChoice" >
</ListView>

increase android:layout_width to say around 320dp

FabianCook
  • 20,269
  • 16
  • 67
  • 115
Anuranjit Maindola
  • 1,507
  • 1
  • 14
  • 30