我正在使用 jfenstein 的滑动菜单库。但我需要分别控制两个滑动菜单。有时必须禁用第二个。有时必须禁用第一个滑动菜单。
当我使用 menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); 两者都有影响。
这是我的代码:
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();