public final class MarginLayoutParamsCompat extends Object
MarginLayoutParams
added after API 4.Modifier and Type | Method and Description |
---|---|
static int |
getLayoutDirection(ViewGroup.MarginLayoutParams lp)
Returns the layout direction.
|
static int |
getMarginEnd(ViewGroup.MarginLayoutParams lp)
Get the relative ending margin that was set.
|
static int |
getMarginStart(ViewGroup.MarginLayoutParams lp)
Get the relative starting margin that was set.
|
static boolean |
isMarginRelative(ViewGroup.MarginLayoutParams lp)
Check if margins are relative.
|
static void |
resolveLayoutDirection(ViewGroup.MarginLayoutParams lp,
int layoutDirection)
This will be called by
View.requestLayout() . |
static void |
setLayoutDirection(ViewGroup.MarginLayoutParams lp,
int layoutDirection)
Set the layout direction.
|
static void |
setMarginEnd(ViewGroup.MarginLayoutParams lp,
int marginEnd)
Set the relative end margin.
|
static void |
setMarginStart(ViewGroup.MarginLayoutParams lp,
int marginStart)
Set the relative start margin.
|
public static int getMarginStart(ViewGroup.MarginLayoutParams lp)
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.
lp
- LayoutParams to querypublic static int getMarginEnd(ViewGroup.MarginLayoutParams lp)
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.
lp
- LayoutParams to querypublic static void setMarginStart(ViewGroup.MarginLayoutParams lp, int marginStart)
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.
lp
- LayoutParams to querymarginStart
- the desired start margin in pixelspublic static void setMarginEnd(ViewGroup.MarginLayoutParams lp, int marginEnd)
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.
lp
- LayoutParams to querymarginEnd
- the desired end margin in pixelspublic static boolean isMarginRelative(ViewGroup.MarginLayoutParams lp)
public static int getLayoutDirection(ViewGroup.MarginLayoutParams lp)
ViewCompat.LAYOUT_DIRECTION_LTR
or
ViewCompat.LAYOUT_DIRECTION_RTL
.public static void setLayoutDirection(ViewGroup.MarginLayoutParams lp, int layoutDirection)
layoutDirection
- the layout direction.
Should be either ViewCompat.LAYOUT_DIRECTION_LTR
or ViewCompat.LAYOUT_DIRECTION_RTL
.public static void resolveLayoutDirection(ViewGroup.MarginLayoutParams lp, int layoutDirection)
View.requestLayout()
. Left and Right margins
may be overridden depending on layout direction.