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);
精彩评论