In the current mainstream app development, part of the main layout of the side-slip menu, once made Android slide menu. Most choose to use the third-party open-source framework on GitHub Sildingmenu, but the framework is slightly cumbersome. The good news is that Google has open source a side-slip menu layout component: Drawerlayout. Drawerlayout is a component in the V4 package. is also directly inherited from the ViewGroup class. So this class is also a container class. Using the drawerlayout can easily achieve the drawer effect, the steps to use the Drawerlayout have the following 1 points:
1) in Drawerlayout, the first child view must be a view of the display content, and setting its Layout_width and Layout_height properties is match_parent.
2) The second view is a drawer view, and the property layout_gravity= "Left|right", which indicates whether to slide out from the left or the right. Set it's layout_height= "Match_parent"
<android.support.v4.widget.drawerlayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns : tools= "Http://schemas.android.com/tools" android:id= "@+id/drawerlayout" android:layout_width= "Match_ Parent " android:layout_height=" match_parent " tools:context=". Mainactivity "> <textview android:id=" @+id/textview " android:layout_width=" Match_parent " android:layout_height= "Match_parent" android:gravity= "center" android:text= "content"/> < ListView android:id= "@+id/listview" android:layout_width= "80DP" android:layout_height= "Match_ Parent " android:layout_gravity=" left " android:background=" #FFB5C5 "/> </ Android.support.v4.widget.drawerlayout>
Android Slide Menu-drawerlayout Basic use