Jfeinstein10 SlidingMenu: how to stop the sliding menu

Soon, I have a slide menu, and I want it to display only the menu when the user clicks the menu button, rather than moving left → right (or right to left).
My menu configuration looks like this:

    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 do not see any configurations to prevent the sliding menu. Please, could you tell me how can I do this?
Thanks in advance.

+4
source share
1 answer

This will disable scrolling:

getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);

And this will make the menu switch when you click on the application 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);
}
+8
source

All Articles