jfeinstein10 SlidingMenu: how to stop sliding menu

前端 未结 1 825
无人共我
无人共我 2021-01-19 15:02

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

相关标签:
1条回答
  • 2021-01-19 15:27

    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);
    }
    
    0 讨论(0)
提交回复
热议问题