SlidingMenu from jfeinstein10 without ActionBarSherlock example

那年仲夏 提交于 2019-11-28 06:17:40

问题


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?


回答1:


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();


来源:https://stackoverflow.com/questions/17557900/slidingmenu-from-jfeinstein10-without-actionbarsherlock-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!