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);
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>
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.
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