Introduction
Slidingmenu as a sliding sidebar is mainly used instead of the Android traditional menu menus.
Import Method
Slidingmenu previously relied on another open source Library Actionbarsherlock, but is now replaced by AppCompat. Only need to import Slidingmenu Library, APPCOMPAT-SUPPORT-V7 will import the project by default
Specific: Andriod studio->file->new->import Module, select Slidingmenu-master\library, After the import, you need to modify the Buildtoolsversion property in the project's Build.gradle, instead of 19.1.0.
How to use
Slidingmenu = new Slidingmenu (this); Slidingmenu.setmode (Slidingmenu.left); Slidingmenu.setbehindoffsetres ( R.dimen.sliding_menu_offset); Slidingmenu.settouchmodeabove (Slidingmenu.touchmode_fullscreen); Slidingmenu.attachtoactivity (this, slidingmenu.sliding_content); Slidingmenu.setmenu (R.layout.slidingmenu);
The meaning of each API can be referred to ctrl+q interpretation, are better understood.
R.layout.slidingmenu refers to the Slidingmenu layout file:
<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Match_ Parent " android:layout_height=" match_parent " android:background=" #FF999999 "> < Com.jeremyfeinstein.slidingmenu.lib.SlidingMenu android:id= "@+id/slidingmenulayout" android:layout_ height= "Match_parent" android:layout_width= "match_parent" > <button android:text= "click Me" android:layout_width= "match_parent" android:layout_height= "wrap_content" > </Button> </com.jeremyfeinstein.slidingmenu.lib.SlidingMenu></LinearLayout>
R.dimen.sliding_menu_offset refers to the distance that Slidingmenu can be delineated:
<resources> <!--Default screen margins, per the Android Design Guidelines- <dimen name= " Sliding_menu_offset ">200dp</dimen></resources>
Slidingmenu in Android