问题
I am using jfenstein's sliding menu lib. But I need to control two sliding menus separately. Sometimes second has to be disabled.And sometimes first slidingmenu has to be disabled.
When I have used menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); both of them effected.
This my code :
menu = new SlidingMenu(activity);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowDrawable(R.drawable.sliding_menu_shadow);
menu.setBehindOffsetRes(R.dimen.sliding_menu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(activity, SlidingMenu.SLIDING_WINDOW);
menu.setMenu(R.layout.sliding_menu_frame);
menu.setMode(SlidingMenu.LEFT_RIGHT);
SlidingMenuListFragment slidingMenuListFragment = new SlidingMenuListFragment();
slidingMenuListFragment.setMenuBuilder(this);
/*
* left menu
*/
activity.getSupportFragmentManager().beginTransaction()
.replace(R.id.sliding_menu_frame, slidingMenuListFragment)
.commit();
/*
* right menu
*/
SlidingMenuListFragment rightMenu = new SlidingMenuListFragment();
rightMenu.setMenuBuilder(this);
menu.setSecondaryMenu(R.layout.sliding_menu_frame);
activity.getSupportFragmentManager()
.beginTransaction()
.replace(R.id.sliding_menu_frame, rightMenu )
.commit();
回答1:
I have the same problem and I fix it with the following :
//can open left and right panel
menu.setMode(SlidingMenu.LEFT_RIGHT);
//can only open left panel and show only left (perhaps overlay the right panel ?)
menu.setMode(SlidingMenu.LEFT);
but it only works to "disable/make invisible" the right panel if you do :
menu.setMode(SlidingMenu.RIGHT);
it only show the left panel on the right.
来源:https://stackoverflow.com/questions/19249669/slidingmenujfeinstein-how-to-control-secondary-sliding-menu