开发者

How do I use an Android constant value of FILL_PARENT from java

BACKGROUND: The Android documentation states:

Constants public static final int FILL_PARENT

Special value for the height or width requested by a View. FILL_PARENT means that the view wants to be as big as its parent, mi开发者_StackOverflow社区nus the parent's padding, if any. This value is deprecated starting in API Level 8 and replaced by MATCH_PARENT.

Constant Value: -1 (0xffffffff)

QUESTION:

I'm sure it is not expected for me to actually define this value, but it is not clear how to use it.

For example: I want to say something like

LayoutParams slp = new LayoutParams(android.R.FILL_PARENT,android.R.FILL_PARENT);

But I know that is not right.

How do I access this constant from java


That constant is used to specify a layout width or height so in xml you would do this

android:layout_width="FILL_PARENT"

and in code do

new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜