Close navigation drawer in Android by tapping on the empty portion of the screen -
My Android app has a navigation drawer and its visibility is controlled by the app icon in the action bar. Not only should the tap be able to close the drawer, but if the user taps on the empty (non-occupied) part of the screen.
& lt; Android.support.v4.widget.DrawerLayout xmlns: This is my main layout Android = "http://schemas.android.com/apk/res/android" Android: Id = "@ + id / drawer_layout" Android: layout_width = "Match_parent" Android: layout_height = "match_parent" & gt; & Lt; FrameLayout Android: id = "@ + id / content_frame" Android: layout_width = "match_parent" android: layout_height = "match_parent" /> & Lt; Android: layout_heid = "match_parent" android: layout_gravity = "start" android: choiceMode = "singleChoice" Android: Background = "@color / white": ListView Android: id = "@ + id / left_drawer" Android: layout_width = "240dp" Style = "@ style / list viewer" />
I do not understand which one layout I need to determine a listener, because when I open the navigation drawer it's my '240dp' list view, but The rest of the screen is like 'transparent black', I think 'transparent black' layout which
found this:
mDrawerLayout.setDrawerLockMode (DrawerLayout.LOCK_MODE_LOCKED_CLOSED); // this was set to LOCK_MODE_LOCKED_OPENED before
Comments
Post a Comment