MarginLayoutParamsCompat
class MarginLayoutParamsCompat
Helper for accessing API features in MarginLayoutParams in a backwards compatible way.
Summary
Public functions |
|
|---|---|
java-static Int |
This function is deprecated. Use |
java-static Int |
@ReplaceWith(expression = "lp.getMarginEnd()")This function is deprecated. Use |
java-static Int |
@ReplaceWith(expression = "lp.getMarginStart()")This function is deprecated. Use |
java-static Boolean |
@ReplaceWith(expression = "lp.isMarginRelative()")This function is deprecated. Use |
java-static Unit |
@ReplaceWith(expression = "lp.resolveLayoutDirection(layoutDirection)")This function is deprecated. Use |
java-static Unit |
@ReplaceWith(expression = "lp.setLayoutDirection(layoutDirection)")This function is deprecated. Use |
java-static Unit |
@ReplaceWith(expression = "lp.setMarginEnd(marginEnd)")This function is deprecated. Use |
java-static Unit |
@ReplaceWith(expression = "lp.setMarginStart(marginStart)")This function is deprecated. Use |
Public functions
java-static fungetLayoutDirection(lp: ViewGroup.MarginLayoutParams): Int
Returns the layout direction. Can be either LAYOUT_DIRECTION_LTR or LAYOUT_DIRECTION_RTL.
| Returns | |
|---|---|
Int |
the layout direction. |
@ReplaceWith(expression = "lp.getMarginEnd()")
java-static fungetMarginEnd(lp: ViewGroup.MarginLayoutParams): Int
Get the relative ending margin that was set.
On platform versions supporting bidirectional text and layouts this value will be resolved into the LayoutParams object's left or right margin as appropriate when the associated View is attached to a window or when the layout direction of that view changes.
| Parameters | |
|---|---|
lp: ViewGroup.MarginLayoutParams |
LayoutParams to query |
| Returns | |
|---|---|
Int |
the margin along the ending edge in pixels |
@ReplaceWith(expression = "lp.getMarginStart()")
java-static fungetMarginStart(lp: ViewGroup.MarginLayoutParams): Int
Get the relative starting margin that was set.
On platform versions supporting bidirectional text and layouts this value will be resolved into the LayoutParams object's left or right margin as appropriate when the associated View is attached to a window or when the layout direction of that view changes.
| Parameters | |
|---|---|
lp: ViewGroup.MarginLayoutParams |
LayoutParams to query |
| Returns | |
|---|---|
Int |
the margin along the starting edge in pixels |
@ReplaceWith(expression = "lp.isMarginRelative()")
java-static funisMarginRelative(lp: ViewGroup.MarginLayoutParams): Boolean
Check if margins are relative.
| Returns | |
|---|---|
Boolean |
true if either marginStart or marginEnd has been set. |
@ReplaceWith(expression = "lp.resolveLayoutDirection(layoutDirection)")
java-static funresolveLayoutDirection(
lp: ViewGroup.MarginLayoutParams,
layoutDirection: Int
): Unit
This will be called by requestLayout. Left and Right margins may be overridden depending on layout direction.
@ReplaceWith(expression = "lp.setLayoutDirection(layoutDirection)")
java-static funsetLayoutDirection(
lp: ViewGroup.MarginLayoutParams,
layoutDirection: Int
): Unit
Set the layout direction.
| Parameters | |
|---|---|
lp: ViewGroup.MarginLayoutParams |
LayoutParameters for which to set the layout direction. |
layoutDirection: Int |
the layout direction. Should be either |
@ReplaceWith(expression = "lp.setMarginEnd(marginEnd)")
java-static funsetMarginEnd(lp: ViewGroup.MarginLayoutParams, marginEnd: Int): Unit
Set the relative end margin.
On platform versions supporting bidirectional text and layouts this value will be resolved into the LayoutParams object's left or right margin as appropriate when the associated View is attached to a window or when the layout direction of that view changes.
| Parameters | |
|---|---|
lp: ViewGroup.MarginLayoutParams |
LayoutParams to query |
marginEnd: Int |
the desired end margin in pixels |
@ReplaceWith(expression = "lp.setMarginStart(marginStart)")
java-static funsetMarginStart(lp: ViewGroup.MarginLayoutParams, marginStart: Int): Unit
Set the relative start margin.
On platform versions supporting bidirectional text and layouts this value will be resolved into the LayoutParams object's left or right margin as appropriate when the associated View is attached to a window or when the layout direction of that view changes.
| Parameters | |
|---|---|
lp: ViewGroup.MarginLayoutParams |
LayoutParams to query |
marginStart: Int |
the desired start margin in pixels |