Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sliding menu (library) always fullscreen

I'm trying to implement the sliding menu library in my app. My problem now is that I don't seem to be able to control the width of the menu. It is always fullscreen.

Can anybody tell me how to resolve this?

Here is the code I've been playing with.

SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
menu.setBehindWidth(10);
menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);
like image 692
acedanger Avatar asked Feb 14 '13 20:02

acedanger


2 Answers

For those that happen to stumble upon this question, in search of how to resolve it - I was able to resolve my issue by using the following code in my onCreate method.

SlidingMenu sm = getSlidingMenu();
sm.setShadowWidthRes(R.dimen.slidingmenuWidth);
sm.setBehindOffsetRes(R.dimen.slidingmenuOffset);
sm.setFadeDegree(0.35f);
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);

<dimen name="slidingmenuWidth">15dp</dimen>
<dimen name="slidingmenuOffset">60dp</dimen>
like image 124
acedanger Avatar answered Nov 14 '22 22:11

acedanger


One of the commit logs read Only behind width not working now [jfeinstein10]. Probably its broken.

What you CAN do is to go to biggest component containing everything and set android:minWidth on it. After a cursory look it seems like it might be menu_frame.xml. But you might want to check a few things.

like image 42
Dheeraj Bhaskar Avatar answered Nov 14 '22 22:11

Dheeraj Bhaskar