抽屉在右侧抽屉中切换

时间:2014-12-06 10:33:08

标签: android

我正在使用左右菜单创建抽屉布局,因为它工作正常但我需要在我打开右侧菜单时停止切换抽屉图标。我很困惑,请帮忙。  提前谢谢。

switch(item.getItemId()){
    case R.id.add_member:
        if(chk==0){
            drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED,Gravity.RIGHT);
            chk=1;
            if(drawer.isDrawerOpen(Gravity.LEFT))
            {
                //ActivityCompat.invalidateOptionsMenu(Main.this);
                drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED,Gravity.RIGHT);
                    drawer.closeDrawer(Gravity.LEFT);
                    drawer.openDrawer(Gravity.RIGHT);
                    sh=1;

            }
            else{
                drawer.openDrawer(Gravity.RIGHT);
                sh=1;
            }
        }
        else if(chk==1){
            drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT);
            drawer.closeDrawer(Gravity.RIGHT);
            chk=0;

        }
        break;

0 个答案:

没有答案