ContainersKt
public final class ContainersKt
Summary
Public methods
box
public static final @NonNull LayoutElementBuilders.Box box(
@NonNull LayoutElementBuilders.LayoutElement... contents,
DimensionBuilders.ContainerDimension width,
DimensionBuilders.ContainerDimension height,
LayoutModifier modifier,
int horizontalAlignment,
int verticalAlignment
)
Creates a container which stacks all of its children on top of one another. This also allows to add a background color, or to have a border around them with some padding.
| Parameters | |
|---|---|
@NonNull LayoutElementBuilders.LayoutElement... contents |
The list of child elements to place inside this container. |
DimensionBuilders.ContainerDimension width |
The width of the box. Defaults to wrap. |
DimensionBuilders.ContainerDimension height |
The height of the box. Defaults to wrap. |
LayoutModifier modifier |
Modifiers to set to this element |
int horizontalAlignment |
The horizontal alignment of the element inside this box. Defaults to center aligned. |
int verticalAlignment |
The vertical alignment of the element inside this box. Defaults to center aligned. |
column
public static final @NonNull LayoutElementBuilders.Column column(
@NonNull LayoutElementBuilders.LayoutElement... contents,
DimensionBuilders.ContainerDimension width,
DimensionBuilders.ContainerDimension height,
LayoutModifier modifier,
int horizontalAlignment
)
Creates a column of elements. Each child element will be laid out vertically, one after another (i.e. stacking down). This element will size itself to the smallest size required to hold all of its children (e.g. if it contains three elements sized 10x10, 20x20 and 30x30, the resulting column will be 30x60).
If specified, horizontal_alignment can be used to control the gravity inside the container, affecting the horizontal placement of children whose width are smaller than the resulting column width.
| Parameters | |
|---|---|
@NonNull LayoutElementBuilders.LayoutElement... contents |
The list of child elements to place inside this container. |
DimensionBuilders.ContainerDimension width |
The width of the box. Defaults to wrap. |
DimensionBuilders.ContainerDimension height |
The height of the box. Defaults to wrap. |
LayoutModifier modifier |
Modifiers to set to this element |
int horizontalAlignment |
The horizontal alignment of the element inside this box. Defaults to center aligned. |
row
public static final @NonNull LayoutElementBuilders.Row row(
@NonNull LayoutElementBuilders.LayoutElement... contents,
DimensionBuilders.ContainerDimension width,
DimensionBuilders.ContainerDimension height,
LayoutModifier modifier,
int verticalAlignment
)
Creates a row of elements. Each child will be laid out horizontally, one after another (i.e. stacking to the right). This element will size itself to the smallest size required to hold all of its children (e.g. if it contains three elements sized 10x10, 20x20 and 30x30, the resulting row will be 60x30).
If specified, verticalAlignment can be used to control the gravity inside the container, affecting the vertical placement of children whose width are smaller than the resulting row height.
| Parameters | |
|---|---|
@NonNull LayoutElementBuilders.LayoutElement... contents |
The list of child elements to place inside this container. |
DimensionBuilders.ContainerDimension width |
The width of the box. Defaults to wrap. |
DimensionBuilders.ContainerDimension height |
The height of the box. Defaults to wrap. |
LayoutModifier modifier |
Modifiers to set to this element |
int verticalAlignment |
The vertical alignment of the element inside this box. Defaults to center aligned. |
spacer
public static final @NonNull LayoutElementBuilders.Spacer spacer(
DimensionBuilders.SpacerDimension width,
DimensionBuilders.SpacerDimension height,
LayoutModifier modifier,
@RequiresSchemaVersion(major = 1, minor = 200) DimensionBuilders.HorizontalLayoutConstraint horizontalLayoutConstraint,
@RequiresSchemaVersion(major = 1, minor = 200) DimensionBuilders.VerticalLayoutConstraint verticalLayoutConstraint
)
Creates a simple spacer, typically used to provide padding between adjacent elements.
| Parameters | |
|---|---|
DimensionBuilders.SpacerDimension width |
The width of the box. Defaults to wrap. |
DimensionBuilders.SpacerDimension height |
The height of the box. Defaults to wrap. |
LayoutModifier modifier |
Modifiers to set to this element |
@RequiresSchemaVersion(major = 1, minor = 200) DimensionBuilders.HorizontalLayoutConstraint horizontalLayoutConstraint |
The bounding constraints for the layout affected by the dynamic value from |
@RequiresSchemaVersion(major = 1, minor = 200) DimensionBuilders.VerticalLayoutConstraint verticalLayoutConstraint |
The bounding constraints for the layout affected by the dynamic value from |