| java.lang.Object | ||
| ↳ | android.view.ViewGroup.LayoutParams | |
| ↳ | android.view.ViewGroup.MarginLayoutParams | |
Known Direct Subclasses
|
Known Indirect Subclasses
|
Per-child layout information for layouts that support margins. See ViewGroup Margin Layout Attributes for a list of all child view attributes that this class supports.
| XML Attributes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
|||||||||
| android:layout_marginBottom | setMargins(int,int,int,int) | Specifies extra space on the bottom side of this view. | |||||||||
| android:layout_marginEnd | setMarginEnd(int) | Specifies extra space on the end side of this view. | |||||||||
| android:layout_marginLeft | setMargins(int,int,int,int) | Specifies extra space on the left side of this view. | |||||||||
| android:layout_marginRight | setMargins(int,int,int,int) | Specifies extra space on the right side of this view. | |||||||||
| android:layout_marginStart | setMarginStart(int) | Specifies extra space on the start side of this view. | |||||||||
| android:layout_marginTop | setMargins(int,int,int,int) | Specifies extra space on the top side of this view. | |||||||||
| [Expand]
Inherited XML Attributes
|
|||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.ViewGroup.LayoutParams
|
|||||||||||
| [Expand]
Inherited Constants
|
|||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.ViewGroup.LayoutParams
|
|||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
bottomMargin | The bottom margin in pixels of the child. | |||||||||
|
|
leftMargin | The left margin in pixels of the child. | |||||||||
|
|
rightMargin | The right margin in pixels of the child. | |||||||||
|
|
topMargin | The top margin in pixels of the child. | |||||||||
| [Expand]
Inherited Fields
|
|||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.ViewGroup.LayoutParams
|
|||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Creates a new set of layout parameters.
|
||||||||||
|
|
|
||||||||||
|
|
Copy constructor.
|
||||||||||
|
|
|
||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
Retuns the layout direction.
|
|||||||||
|
|
|
Returns the end margin in pixels.
|
|||||||||
|
|
|
Returns the start margin in pixels.
|
|||||||||
|
|
|
Check if margins are relative.
|
|||||||||
|
|
|
This will be called by
requestLayout().
|
|||||||||
|
|
|
Set the layout direction
|
|||||||||
|
|
|
Sets the relative end margin.
|
|||||||||
|
|
|
Sets the relative start margin.
|
|||||||||
|
|
|
Sets the margins, in pixels.
|
|||||||||
| [Expand]
Inherited Methods
|
|||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.ViewGroup.LayoutParams
|
|||||||||||
From class java.lang.Object
|
|||||||||||
Specifies extra space on the bottom side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (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.
This corresponds to the global attribute resource symbol layout_marginBottom.
Specifies extra space on the end side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (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.
This corresponds to the global attribute resource symbol layout_marginEnd.
Specifies extra space on the left side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (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.
This corresponds to the global attribute resource symbol layout_marginLeft.
Specifies extra space on the right side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (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.
This corresponds to the global attribute resource symbol layout_marginRight.
Specifies extra space on the start side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (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.
This corresponds to the global attribute resource symbol layout_marginStart.
Specifies extra space on the top side of this view. This space is outside this view's bounds.
Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". Available units are: px (pixels), dp (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.
This corresponds to the global attribute resource symbol layout_marginTop.
The bottom margin in pixels of the child. Call setLayoutParams(LayoutParams) after reassigning a new value to this field.
The left margin in pixels of the child. Call setLayoutParams(LayoutParams) after reassigning a new value to this field.
The right margin in pixels of the child. Call setLayoutParams(LayoutParams) after reassigning a new value to this field.
The top margin in pixels of the child. Call setLayoutParams(LayoutParams) after reassigning a new value to this field.
Creates a new set of layout parameters. The values are extracted from the supplied attributes set and context.
| c | the application environment |
|---|---|
| attrs | the set of attributes from which to extract the layout parameters' values |
Copy constructor. Clones the width, height and margin values of the source.
| source | The layout params to copy from. |
|---|
Retuns the layout direction. Can be either LAYOUT_DIRECTION_LTR or LAYOUT_DIRECTION_RTL.
Returns the end margin in pixels.
Returns the start margin in pixels.
Check if margins are relative.
This will be called by requestLayout(). Left and Right margins may be overridden depending on layout direction.
| layoutDirection | the direction of the layout LAYOUT_DIRECTION_LTR LAYOUT_DIRECTION_RTL |
|---|
Set the layout direction
| layoutDirection | the layout direction. Should be either LAYOUT_DIRECTION_LTR or LAYOUT_DIRECTION_RTL. |
|---|
Sets the relative end margin.
| end | the end margin size |
|---|
Sets the relative start margin.
| start | the start margin size |
|---|
Sets the margins, in pixels. A call to requestLayout() needs to be done so that the new margins are taken into account. Left and right margins may be overriden by requestLayout() depending on layout direction.
| left | the left margin size |
|---|---|
| top | the top margin size |
| right | the right margin size |
| bottom | the bottom margin size |