SlidingMenu(jfeinstein) - How to control secondary sliding menu

社会主义新天地 提交于 2019-12-12 13:28:36

问题


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

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