@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MENU) { SlidingMenu slidingMenu = getSlidingMenu(); if (slidingMenu.isMenuShowing()) slidingMenu.showContent(true); else slidingMenu.showMenu(true); } return super.onKeyDown(keyCode, event); }
private void initSlidingMenu() { setBehindContentView(R.layout.main_left_layout); FragmentTransaction mFragementTransaction = getSupportFragmentManager().beginTransaction(); Fragment mFrag = new LeftSlidingMenuFragment(); mFragementTransaction.replace(R.id.main_left_fragment, mFrag); mFragementTransaction.commitAllowingStateLoss(); mSlidingMenu = getSlidingMenu(); mSlidingMenu.setMode(SlidingMenu.RIGHT); mSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset); mSlidingMenu.setFadeDegree(0.35f); mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE); mSlidingMenu.setFadeEnabled(true); mSlidingMenu.setBehindScrollScale(0.333f); mSlidingMenu.requestLayout(); }
public void onRightClicked() { SlidingMenu slidingMenu = getSlidingMenu(); if (slidingMenu.isMenuShowing()) slidingMenu.showContent(true); else slidingMenu.showMenu(true); }