Simply note the properties.
Slidingmenu commonly used properties are:
Menu.setmode (slidingmenu.left);//Set Left slide menu
Menu.settouchmodeabove (Slidingmenu.touchmode_fullscreen);//sets the screen range to slide, which can be slid across the full-screen area
Menu.setshadowdrawable (R.drawable.shadow);//Set Shadow Picture
Menu.setshadowwidthres (r.dimen.shadow_width);//Set the width of the shadow picture
Menu.setbehindoffsetres (R.dimen.slidingmenu_offset); the remaining width displayed on the main page when//slidingmenu
Menu.setbehindwidth (400);//Set the width of the Slidingmenu menu
Menu.setfadedegree (0.35f); degree of gradient when//slidingmenu sliding
Menu.attachtoactivity (this, slidingmenu.sliding_content);//enable the Slidingmenu to be attached to the activity
Menu.setmenu (r.layout.menu_layout);//Set Menu layout file
Menu.toggle ();//dynamic judgment automatically shuts down or turns on Slidingmenu
Menu.showmenu ();//Display Slidingmenu
Menu.showcontent ();//display content
Menu.setonopenlistener (Onopenlistener);//Monitor Slidingmenu Open
About close Menu There are two listeners, in a nutshell, for the menu Close event, one is when, and the other is after
Menu. Onclosedlistener (Onclosedlistener);//monitor Slidingmenu Shutdown Event
Menu. Onclosedlistener (Onclosedlistener);//monitor Slidingmenu post-shutdown event
Left and right can be slidingmenu menu only need to set
Menu.setmode (slidingmenu.left_right); property, and then set the layout file for the menu on the right
Menu.setsecondaryshadowdrawable (r.drawable.shadowright);//Shadow picture on right menu
Setting the Slidingmenu property
SM = Getslidingmenu ();
If only the left menu is displayed, the right side, left, is supported on Left_right
Sm.setmode (slidingmenu.left_right);//Set menu slide mode, whether the menu appears on the left or right, or both sides
Sm.setshadowdrawable (R.drawable.shadow);//Set the Shadow's picture resource
Sm.setshadowwidthres (r.dimen.shadow_width);//Set the width of the shadow picture
Sm.setbehindwidth (200);//Setting the width of the menu
Sm.setbehindoffsetres (R.dimen.slidingmenu_offset); the remaining width displayed on the main page when//slidingmenu
Sm.settouchmodeabove (Slidingmenu.touchmode_fullscreen);//Set the area of the slide
Supports the right-side underline menu:
Slidingmenu can simultaneously support the left and right side of the menu, non-conflict, and animation beautiful, good experience.
Sm.setsecondarymenu (r.layout.menu_frame2);//Set Right menu
Sm.setsecondaryshadowdrawable (r.drawable.shadowright);//Set the picture Resource for the right menu shadow
Right Slidingmenu fragment.
Getsupportfragmentmanager (). BeginTransaction (). Replace (r.id.menu_frame2, New Samplelistfragment ()). commit ();
Slidingmenu = Getslidingmenu ();
Whether the setting is left or right, or whether you can slip around
Slidingmenu.setmode (Slidingmenu.left_right);
Set Shadow Width
Slidingmenu.setshadowwidth (Getwindowmanager (). Getdefaultdisplay (). GetWidth ()/40);
Set left menu Shadow picture
Slidingmenu.setshadowdrawable (R.drawable.shadow);
Set Right menu shadow picture
Slidingmenu.setsecondaryshadowdrawable (R.drawable.right_shadow);
Set the ratio of the menu to the screen
Slidingmenu.setbehindoffset (Getwindowmanager (). Getdefaultdisplay (). GetWidth ()/5);
Sets whether the menu fades when sliding
Slidingmenu.setfadeenabled (TRUE);
Set the scale of the fade
Slidingmenu.setfadedegree (0.4f);
Set the drag effect when sliding
Slidingmenu.setbehindscrollscale (0);
To set the menu to slide, touch the range of the screen
Slidingmenu.settouchmodeabove (Slidingmenu.touchmode_fullscreen);
Project Address:
Https://github.com/jfeinstein10/SlidingMenu
Https://github.com/jakeWharton/actionbarsherlock
"Android" Slidingmenu property details