Open Source Project Guillotinemenu usage Guide
First on:
The IDE uses Android studio.
First download the library reference for the Guillotinemenu project to the project:
http://download.csdn.net/detail/u012027644/8840527
Guillotine.xml: This XML is the layout of the menu
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "xmlns:app=" Http://schemas.android.com/apk/res-auto "android:layout_width=" Match_parent "Android:layout_h eight= "Match_parent" android:background= "@color/guillotine_background" android:orientation= "vertical" > <and Roid.support.v7.widget.Toolbar style= "@style/toolbar" app:contentinsetstart= "0DP" > <imageview Android:id= "@+id/guillotine_hamburger" style= "@style/imageview.hamburger" android:src= "@dr Awable/ic_menu "/> </android.support.v7.widget.Toolbar> <linearlayout android:id=" @+id/profile_gr OUP "style=" @style/linearlayout.guillotineitem "android:layout_margintop=" @dimen/guillotine_medium_margin "&G T <imageview style= "@style/imageview.guillotineitem" android:src= "@drawable/ic_profile"/> <textview style= "@style/textview.guillotineitem" android:text= "My Info"/> </LinearLayout> <linearlayout Android:id= "@+id/feed_group" style= "@style/linearlayout.guillotineitem" > <imageview style= "@style/imageview.guillotineitem" android:src= "@drawable/ic_feed"/> <textview St yle= "@style/textview.guillotineitem" android:text= "My Discoveries"/> </LinearLayout> <linearlayout Android:id= "@+id/activity_group" style= "@style/linearlayout.guillotineitem" > <imageview style= "@style/imageview.guillotineitem" android:src= "@drawable/ic_activity"/> <textview style= "@style/textview.guillotineitem" android:text= "My Activities"/> </LinearLayout> <view Android:layout_width= "Match_parent" android:layout_height= "@dimen/guillotine_divider_height"/> <LinearLa Yout android:id= "@+id/settings_group "style=" @style/linearlayout.guillotineitem "> <imageview style=" @style/I Mageview.guillotineitem "android:src=" @drawable/ic_settings "/> <textview style=" @style /textview.guillotineitem "android:text=" Settings "/> </LinearLayout></LinearLayout>
Activity_main.xml: Layout of the main activity
<?xml version= "1.0" encoding= "Utf-8"? ><framelayout xmlns:android= "http://schemas.android.com/apk/res/ Android "xmlns:app=" Http://schemas.android.com/apk/res-auto "android:id=" @+id/root "android:layout_width=" match_p Arent "android:layout_height=" match_parent "android:orientation=" vertical "> <!--Top occlusion Slit section---<view android:layout_gravity= "Top" android:layout_width= "Match_parent" android:layout_height= "35DP" android:background= "@color/guillotine_background"/> <!--title bar--<linearlayout Android:layo Ut_width= "Match_parent" android:layout_height= "match_parent" android:orientation= "vertical" > <a Ndroid.support.v7.widget.Toolbar android:id= "@+id/toolbar" app:contentinsetstart= "0DP" St yle= "@style/toolbar" > <imageview android:id= "@+id/content_hamburger" style= "@style/imageview.hamburger" android:src= "@drawable/ic_menu_90"/> <textview android:layout_width= "wrap_content "Android:layout_height=" wrap_content "android:layout_gravity=" center "Androi d:text= "Guillotine Menu" android:textcolor= "#ffffff" android:textstyle= "bold" android:t Extsize= "24sp"/> </android.support.v7.widget.Toolbar> </LinearLayout></FrameLayout>
Code for the main activity:
public class Mainactivity extends Appcompatactivity {private static final long ripple_duration = 250; Gets the control @InjectView (R.id.toolbar) toolbar toolbar; Title bar @InjectView (r.id.root) framelayout root; Layout @InjectView (R.id.content_hamburger) ImageView Contenthamburger; menu button @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); Butterknife.inject (this); if (Toolbar! = null) {Setsupportactionbar (toolbar); Getsupportactionbar (). Settitle (NULL); }//Popup menu View Guillotinemenu = Layoutinflater.from (this). Inflate (r.layout.guillotine, NULL); Root.addview (Guillotinemenu); Add popup menu//guillotinebuilder The first parameter is the menu view, the second parameter is the Close menu view is the menu Layout button, the third parameter is the Open menu view is the main Page button new Guillo Tineanimation.guillotinebuilder (Guillotinemenu, Guillotinemenu.findviewbyid (r.id.guillotine_hamburger), conTenthamburger). Setstartdelay (ripple_duration). Setactionbarviewforanimation (Toolbar) . build (); }}
Demo: http://download.csdn.net/detail/u012027644/8840433
Project GitHub Address: https://github.com/Yalantis/GuillotineMenu-Android
Android Open source project Guillotinemenu, cool guillotine menu