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/1c0yCmNQ 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 Set Slidingmenu property SM = Getslidingmenu (); < BR style= "Word-wrap:break-word; Outline:none ">//If only the left menu is displayed, the right side is OK, support is left_right sm.setmode (slidingmenu.left_right);//Set menu slide mode, whether the menu appears on the left or right, Or the left and right sides have sm.setshadowdrawable (R.drawable.shadow);// Set the Shadow's picture resource sm.setshadowwidthres (r.dimen.shadow_width);// Sets the width of the shadow picture //sm.setbehindwidth (200);//Set menu width sm.setbehindoffsetres (R.dimen.slidingmenu_offset); the remaining width of the main page when//slidingmenu is drawn sm.settouchmodeabove (Slidingmenu.touchmode_fullscreen);//Set the area to 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); |