| java.lang.Object | ||
| android.view.ViewGroup.LayoutParams | ||
LayoutParams are used by views to tell their parents how they want to be laid out. See ViewGroup Layout Attributes for a list of all child view attributes that this class supports.
The base LayoutParams class just describes how big the view wants to be for both width and height. For each dimension, it can specify one of:
There are subclasses of LayoutParams for different subclasses of ViewGroup. For example, AbsoluteLayout has its own subclass of LayoutParams which adds an X and Y value.
Known Direct Subclasses
Known Indirect Subclasses| Attribute name | Related methods | |
|---|---|---|
| android:layout_height | Specifies the basic height of the view. | |
| android:layout_width | Specifies the basic width of the view. |
| Value | ||||
|---|---|---|---|---|
| int | FILL_PARENT | Special value for the height or width requested by a View. | -1 | 0xffffffff |
| int | WRAP_CONTENT | Special value for the height or width requested by a View. | -2 | 0xfffffffe |
| public | int | height | Information about how tall the view wants to be. | ||
| public | AnimationParameters | layoutAnimationParameters | Used to animate layouts. | ||
| public | int | width | Information about how wide the view wants to be. |
| ViewGroup.LayoutParams(Context c, AttributeSet attrs) | |||||
| Creates a new set of layout parameters. | |||||
| ViewGroup.LayoutParams(int width, int height) | |||||
| Creates a new set of layout parameters with the specified width and height. | |||||
| void | setBaseAttributes(StyledAttributes a, int widthAttr, int heightAttr) | ||||
| Extracts the layout parameters from the supplied attributes. | |||||
Methods inherited
from class
java.lang.Object
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), db (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
May be one of the following constant values.
| Constant | Value | Description |
|---|---|---|
fill_parent | -1 | The view should be as big as its parent (minus padding). |
wrap_content | -2 | The view should be only big enough to enclose its content (plus padding). |
This corresponds to the global attribute resource symbol layout_height.
May be a dimension value, which is a floating point number appended with a unit such as "14.5sp".
Available units are: px (pixels), db (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
May be one of the following constant values.
| Constant | Value | Description |
|---|---|---|
fill_parent | -1 | The view should be as big as its parent (minus padding). |
wrap_content | -2 | The view should be only big enough to enclose its content (plus padding). |
This corresponds to the global attribute resource symbol layout_width.
layout_width: the width, either an exact value,
WRAP_CONTENT or FILL_PARENTlayout_height: the height, either an exact value,
WRAP_CONTENT or FILL_PARENT| c | the application environment |
|---|---|
| attrs | the set of attributes from which to extract the layout parameters' values |
| width | the width, either FILL_PARENT, WRAP_CONTENT or a fixed size in pixels |
|---|---|
| height | the height, either FILL_PARENT, WRAP_CONTENT or a fixed size in pixels |
| a | the style attributes to extract the parameters from |
|---|---|
| widthAttr | the identifier of the width attribute |
| heightAttr | the identifier of the height attribute |