Original: http://my.eoe.cn/1169143/archive/21892.html
Slidingmenu Introduction:
Slidingmenu is a relatively new setup interface or configuration interface effect, in the main interface left or right slide display settings interface, can easily do a variety of operations. There are a lot of applications that are using this effect now. such as Evernote, Google +, Foursquare, and so on, the domestic pea folder, everyone, 360 mobile phone assistants, etc. are using the Slidingmenu interface scheme.
Project:Http://pan.baidu.com/s/1hq7NQmC
Slidingmenu Common Properties Description:
Menu.setmode (slidingmenu.left);//Set Left slide menu
Menu.settouchmodeabove ( Slidingmenu.touchmode_fullscreen)///Set the sliding screen range, which can slide
Menu.setshadowdrawable (R.drawable.shadow) in the full-screen area;// Set the shadow Picture
Menu.setshadowwidthres (r.dimen.shadow_width);//Set the width of the shadow picture
Menu.setbehindoffsetres ( R.dimen.slidingmenu_offset)//slidingmenu The remaining width displayed on the main page
Menu.setbehindwidth (400);//Setting the width of the Slidingmenu menu
Menu.setfadedegree (0.35f); the degree of//slidingmenu when sliding,
menu.attachtoactivity (this, slidingmenu.sliding_content);// Attach Slidingmenu to activity on
Menu.setmenu (r.layout.menu_layout);//Set menu layout file
Menu.toggle ();// Dynamic judgment automatically turns off or turns on Slidingmenu
Menu.showmenu ();//Display Slidingmenu
Menu.showcontent ();//Display Contents
Menu.setonopenlistener (Onopenlistener);//Listener Slidingmenu Open
About close menu There are two listeners, simply, for the menu Close event, one is when, one is after
Menu. Onclosedlistener (Onclosedlistener);//Listener Slidingmenu Shutdown Event
menu. Onclosedlistener (Onclosedlistener);//monitor Slidingmenu after 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 of the menu:
//slidingmenu can support both sides of the menu, non-conflicting, and animation beautiful, experience good.
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);
Disclaimer: EoE article copyright belongs to the author, protected by law, when reproduced please be sure to include the following information in the form of hyperlinks
Original qwer20042127
Original address: http://my.eoe.cn/1169143/archive/21892.html
"Android" Slidingmenu Property explained (GO)