android - implementation of jeremy feinstein's SlidingMenu -
i'm trying develop application using jeremy feinstein's slidingmenu library. have done in right way described in github instructions. working well, problem when click on action bar home button open slider covers complete screen. want open in half open in facebook slider in facebook app. code below:
public class mainactivity extends slidingfragmentactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //hide title bar getsupportactionbar().setdisplayshowtitleenabled(true); //enable home button getsupportactionbar().sethomebuttonenabled(true); //home display getsupportactionbar().setdisplayhomeasupenabled(true); // getsupportactionbar().setnavigationmode(actionbar.navigation_mode_tabs); setbehindcontentview(r.layout.menu_frame); //slidingmenu menu=getslidingmenu(); slidingmenu menu=new slidingmenu(this); //menu = new slidingmenu(mainactivity.this); menu.setmode(slidingmenu.left); menu.settouchmodeabove(slidingmenu.touchmode_margin); setslidingactionbarenabled(true); menu.setshadowwidth(5); menu.setfadedegree(0.0f); menu.attachtoactivity(mainactivity.this, slidingmenu.sliding_content); menu.setbehindwidth(10); menu.setbehindoffset(10); menu.setbehindscrollscale(0.25f); menu.setmenu(r.layout.menu_frame); } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: toggle(); return true; } return super.onoptionsitemselected(item); } }
you use behindoffset
, behindwidth
or touchmodeabove
. if use view (in layout file):
sliding:behindoffset="@dimen/your_offset" sliding:behindwidth="@dimen/your_width" sliding:touchmodeabove="margin"
further explained
touchmodeabove
- enum designates part of screen touchable when above view showing. margin means left margin. fullscreen means entire screen. default margin.
behindoffset
- dimension representing number of pixels want above view show when behind view showing. default 0.
behindwidth
- dimension representing width of behind view. default width of screen (equivalent behindoffset = 0).
Comments
Post a Comment