The last few days I've been searching for examples on how to make a sliding menu. I've found many ways and decided that jfeinstein10's solution should work best. But the example he has, uses ActionBarSherlock which I don't want, and is also too complicated for me.
I tried to find a simple example with android's action Bar but couldn't find one. Could anyone help?
You have to extend SherlockActivity
, and create a menu.xml
wich is your menu layout.
Then just add those few lines in your onCreate
method.
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.menu);
That what i'm using right now and works perfectly.
If you don't want ActionBar, just hide it like this :
ActionBar myBar = getActionBar();
myBar.hide();