The code is as follows:
<LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical"> <!--Tool Bar - <includeLayout= "@layout/toolbar_main"></include> <Android.support.v4.widget.DrawerLayoutAndroid:id= "@+id/dl_alllayout"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:fitssystemwindows= "true"> <!--The content *************** must be placed below the sliding menu ************** - <includeLayout= "@layout/content_main"/> <!--Sliding Menu - <includeLayout= "@layout/layout_left_menu"></include> </Android.support.v4.widget.DrawerLayout></LinearLayout>
As we all know, the Android system adds the toolbar toolbar and drawer effect to the SUPPORT-V7 package after 3.0:
Import Android.support.v7.app.ActionBarDrawerToggle; import Android.support.v7.widget.Toolbar;
Then add the left slide menu and the main content in the Drawerlayout must pay attention to the priority add, activity in the main content, after adding a scrub menu layout.
If the order is reversed, you cannot respond to any events such as "click", "Scrub" in the drawer window, and when you slide the drawer menu out of the activity, you cannot swipe it with your finger to hide it (you can hide it via the toolbar button).
Because Drawerlayout will finally parse the scrub menu.
Please be careful with the majority of Android Basin friends!!!
Android provides traps for toolbar implementation of the Scrub menu