1

how to set the width of SlidingMenu.I mean the sliding menu occupies the entire screen when i use getSlidingMenu().showMenu()?

Yash Patil
  • 469
  • 4
  • 9

2 Answers2

2

Nope, you got to use this line of code

menu.setBehindOffset(int offsetInPixels);

and if you want to support proportion you got to use system resources.

this.getResources().getInt(R.integer.offsetInPixels);

where offsetInPixels is <integer name="offsetInPixels">your offset</integer> in res/values... res/values-large.... res/values-xlarge...

I'm not able to post an image, and if you'll mark this post as an answer - i'll be able and show you properly with images.

Nabin Kunwar
  • 1,965
  • 14
  • 29
Alex
  • 1,416
  • 1
  • 14
  • 24
0

If you are using Java code:

 /*
  * Sets the behind width.
  *
  * @param i The width the Sliding Menu will open to, in pixels
  */    
  setBehindWidth(int i)

See Reference from source code of jfeistein10's github

Or if you are using XML to define the sliding menu:

sliding:behindWidth="@dimen/YOUR_WIDTH"

See Reference

dumbfingers
  • 7,001
  • 5
  • 54
  • 80
  • Can we specify it in proportion to the screen width.Because right now when i try to give the width 690 it looks good on bluestack but when iuse it on my device it is going out of the screen – Yash Patil Apr 29 '13 at 09:12
  • @YashPatil yes, you can. Please look at this answer: http://stackoverflow.com/a/11608619/763459 – dumbfingers Apr 29 '13 at 09:15