1

如何设置SlidingMenu的宽度。我的意思是当我使用getSlidingMenu().showMenu()时,滑动菜单占据了整个屏幕?

4

2 回答 2

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.

于 2013-04-29T09:36:44.283 回答
0

如果您使用的是 Java 代码:

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

参考来自jfeistein10的github的源代码

或者,如果您使用 XML 来定义滑动菜单:

sliding:behindWidth="@dimen/YOUR_WIDTH"

参考

于 2013-04-29T08:53:41.997 回答