Cloneablepublic static class DependentLayout.LayoutConfig extends ComponentContainer.LayoutConfig
These configs specify the position of a Component in DependentLayout.
If the Component is not in DependentLayout, these layout configs are ignored.
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
ABOVE |
Indicates that a child Component is placed above another child component.
|
static int |
ALIGN_BASELINE |
Indicates that a child component' baseline is depend on another child component's.
|
static int |
ALIGN_BOTTOM |
Indicates that two child components are bottom-aligned.
|
static int |
ALIGN_END |
Indicates that two child components are end-aligned.
|
static int |
ALIGN_LEFT |
Indicates that two child components are left-aligned.
|
static int |
ALIGN_PARENT_BOTTOM |
Indicates that a child Component and its parent Component are bottom-aligned.
|
static int |
ALIGN_PARENT_END |
Indicates that a child Component and its parent Component are end-aligned.
|
static int |
ALIGN_PARENT_LEFT |
Indicates that a child Component and its parent Component are left-aligned.
|
static int |
ALIGN_PARENT_RIGHT |
Indicates that a child Component and its parent Component are right-aligned.
|
static int |
ALIGN_PARENT_START |
Indicates that a child Component and its parent Component are start-aligned.
|
static int |
ALIGN_PARENT_TOP |
Indicates that a child Component and its parent Component are top-aligned.
|
static int |
ALIGN_RIGHT |
Indicates that two child components are right-aligned.
|
static int |
ALIGN_START |
Indicates that two child components are start-aligned.
|
static int |
ALIGN_TOP |
Indicates that two child components are top-aligned.
|
static int |
BELOW |
Indicates that a child Component is placed below another child component.
|
static int |
CENTER_IN_PARENT |
Indicates that a child Component is centered in its parent component.
|
static int |
END_OF |
Indicates that a child Component is placed at the end of another child component.
|
static int |
HORIZONTAL_CENTER |
Indicates that a child Component is horizontally centered in its parent component.
|
static int |
LEFT_OF |
Indicates that a child Component is placed to the left of another child component.
|
static int |
RIGHT_OF |
Indicates that a child Component is placed to the right of another child component.
|
static int |
START_OF |
Indicates that a child Component is placed at the start of another child component.
|
static int |
TRUE |
Indicates that the alignment mode is enabled.
|
static int |
VERTICAL_CENTER |
Indicates that a child Component is vertically centered in its parent component.
|
height, MATCH_CONTENT, MATCH_PARENT, width| 构造器 | 说明 |
|---|---|
LayoutConfig() |
Default constructor used to create a
LayoutConfig instance. |
LayoutConfig(int width,
int height) |
A constructor used to create a
LayoutConfig instance based on the input configs
width and height. |
LayoutConfig(ComponentContainer.LayoutConfig source) |
A constructor used to set layout parameters based on the width, height, and margin of the source layout.
|
LayoutConfig(DependentLayout.LayoutConfig source) |
A constructor used to create a
LayoutConfig instance based on the width, height,
margin, and layout rules of the source layout. |
LayoutConfig(Context context,
AttrSet attrSet) |
A constructor used to create a
LayoutConfig instance based on the context and attribute set. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
addRule(int verb) |
Adds a layout rule that can be interpreted by the
DependentLayout. |
void |
addRule(int verb,
int subject) |
Adds a layout rule that can be interpreted by the
DependentLayout. |
Object |
clone() |
Create DependentLayout.LayoutConfig clone.
|
int |
getRule(int verb) |
Obtains the ID of an associated sibling Component based on the layout rule.
|
int[] |
getRules() |
Obtains the IDs of all associated sibling Components.
|
void |
removeRule(int verb) |
Deletes a layout rule that can be interpreted by
DependentLayout. |
getHorizontalEndMargin, getHorizontalStartMargin, getLayoutDirection, getMarginBottom, getMarginLeft, getMarginRight, getMargins, getMarginsLeftAndRight, getMarginsTopAndBottom, getMarginTop, isMarginsRelative, setMarginBottom, setMarginLeft, setMarginRight, setMargins, setMarginsLeftAndRight, setMarginsRelative, setMarginsTopAndBottom, setMarginToppublic static final int ABOVE
The bottom edge of the child Component is aligned with the top edge of another child component.
public static final int ALIGN_BASELINE
The baseline of the child Component is aligned with the baseline of another child component.
public static final int ALIGN_BOTTOM
The bottom edge of a child Component is aligned with the bottom edge of another child component.
public static final int ALIGN_END
The end edge of a child Component is aligned with the end edge of another child component.
public static final int ALIGN_LEFT
The left edge of a child Component is aligned with the left edge of another child component.
public static final int ALIGN_PARENT_BOTTOM
The bottom edge of a child Component is aligned with the bottom edge of its parent component.
public static final int ALIGN_PARENT_END
The end edge of a child Component is aligned with the end edge of its parent component.
public static final int ALIGN_PARENT_LEFT
The left edge of a child Component is aligned with the left edge of its parent component.
public static final int ALIGN_PARENT_RIGHT
The right edge of a child Component is aligned with the right edge of its parent component.
public static final int ALIGN_PARENT_START
The start edge of a child Component is aligned with the start edge of its parent component.
public static final int ALIGN_PARENT_TOP
The top edge of a child Component is aligned with the top edge of its parent component.
public static final int ALIGN_RIGHT
The right edge of a child Component is aligned with the right edge of another child component.
public static final int ALIGN_START
The start edge of a child Component is aligned with the start edge of another child component.
public static final int ALIGN_TOP
The top edge of a child Component is aligned with the top edge of another child component.
public static final int BELOW
The top edge of the child Component is aligned with the bottom edge of another child component.
public static final int CENTER_IN_PARENT
public static final int END_OF
The start edge of a child Component is aligned with the end edge of another child component.
public static final int HORIZONTAL_CENTER
public static final int LEFT_OF
The right edge of the child Component is aligned with the left edge of another child component.
public static final int RIGHT_OF
The left edge of the child Component is aligned with the right edge of another child component.
public static final int START_OF
The end edge of a child Component is aligned with the start edge of another child component.
public static final int TRUE
This constant is usually used in the LayoutConfig#addRule(int) interface.
public static final int VERTICAL_CENTER
public LayoutConfig()
LayoutConfig instance.public LayoutConfig(Context context, AttrSet attrSet)
LayoutConfig instance based on the context and attribute set.context - Indicates the application context.attrSet - Indicates the attribute set to be used.public LayoutConfig(int width,
int height)
LayoutConfig instance based on the input configs
width and height.width - Indicates the width of the component. The value can be a non-negative integer,
ComponentContainer.LayoutConfig.MATCH_PARENT or ComponentContainer.LayoutConfig.MATCH_CONTENT.height - Indicates the height of the component. The value can be a non-negative integer,
ComponentContainer.LayoutConfig.MATCH_PARENT or ComponentContainer.LayoutConfig.MATCH_CONTENT.public LayoutConfig(DependentLayout.LayoutConfig source)
LayoutConfig instance based on the width, height,
margin, and layout rules of the source layout.source - Indicates the configs of the source layout.public LayoutConfig(ComponentContainer.LayoutConfig source)
source - Specifies parameters of the source layout.public Object clone() throws CloneNotSupportedException
clone 在类中 ComponentContainer.LayoutConfigCloneNotSupportedException - if the object's class does not
support the Cloneable interface. Subclasses
that override the clone method can also
throw this exception to indicate that an instance cannot
be cloned.Cloneablepublic void addRule(int verb,
int subject)
DependentLayout.
The rule determines the position of a specified component dependent on its sibling or parent.
For example, addRule(ALIGN_RIGHT, 11) indicates that a specified component and a component
whose ID is 11 are right-aligned.
verb - Indicates the layout rule, such as ALIGN_RIGHT.subject - Indicates the ID of the Component object to be used as an anchor or a
boolean value (TRUE for true and 0 for false).public void addRule(int verb)
DependentLayout.
The rule determines the position of a specified component dependent on its parent.
For example, addRule(ALIGN_RIGHT) indicates that the specified Component
and its parent are right-aligned.verb - Indicates the layout rule, such as ALIGN_RIGHT.public void removeRule(int verb)
DependentLayout.verb - Indicates the layout rule, such as ALIGN_RIGHT.public int getRule(int verb)
verb - Indicates the layout rule, such as ALIGN_RIGHT.public int[] getRules()