Shortly, I have a slide menu and I want it should only show menu when user press on menu button instead of sliding from left -> right (or right to left).
My menu config look like:
SlidingMenu sm = getSlidingMenu();
sm.setMode(SlidingMenu.LEFT); // or sm.setMode(SlidingMenu.RIGHT);
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
sm.setShadowWidthRes(R.dimen.shadow_width);
sm.setShadowDrawable(R.drawable.shadow);
sm.setBehindScrollScale(0.25f);
sm.setFadeDegree(0.25f);
I don't find any configs to prevent sliding menu. Please could you tell me how can I do it?
Thanks in advance.
This will disable swiping:
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
And this will make the menu toggle on clicking on the app icon in the action bar
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
getSlidingMenu().toggle();
return true;
}
return super.onOptionsItemSelected(item);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With