2013-04-29 35 views

回答

2

不,你必须使用这行代码

menu.setBehindOffset(int offsetInPixels); 

如果你想支持比例,你必须使用系统资源。

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

其中offsetInPixels是<integer name="offsetInPixels">your offset</integer> 在res /值... RES /价值观大.... RES /价值观XLARGE ...

我无法张贴图片,如果你将这篇文章标记为答案 - 我将能够正确显示图像。

0

如果您使用的是Java代码:

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

Reference从jfeistein10的github上的源代码

或者,如果你正在使用XML来定义的滑动菜单:

sliding:behindWidth="@dimen/YOUR_WIDTH" 

Reference

+0

我们可以指定它与屏幕宽度的比例。因为现在,当我尝试给宽度690它看起来不错,但当我用它在我的设备上它是走出屏幕 – 2013-04-29 09:12:10

+0

@YashPatil是的,你能够。请看这个答案:http://stackoverflow.com/a/11608619/763459 – dumbfingers 2013-04-29 09:15:47

相关问题