0

I'm using Jfeinstein10's sliding menu in my app as follows:

slidingMenu = new SlidingMenu(this);
        slidingMenu.setMode(SlidingMenu.LEFT);
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        slidingMenu.setShadowWidthRes(R.dimen.slidingmenu_shadow_width);
        slidingMenu.setShadowDrawable(R.drawable.slidingmenu_shadow);
        slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
        slidingMenu.setFadeDegree(0.35f);
        slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
        slidingMenu.setMenu(R.layout.slidingmenu);

I also activated a menu key listener:

@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ( keyCode == KeyEvent.KEYCODE_MENU ) {
            this.slidingMenu.toggle();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

Now, I want this menu to pop up ONLY when menu key is pressed, and not when swiping from left. I want to do this because I have horizontal scrolling in my activity and this conflicts with the sliding menu.

How do I disable the sliding part and keep only the menu button activation part?

4

1 回答 1

0

好的。这实际上很容易解决。

我换了行

slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);

slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_MARGIN);

然后将库中的MARGIN值改为0.0 dp。

希望对某人有所帮助!

于 2013-10-02T02:15:04.930 回答