Arrangement

@Immutable
object Arrangement

How a Row or Column places its children along the axis it arranges them on, and how much space it leaves between two adjacent children.

An arrangement is handed the extent the container has along that axis together with the extent of each child, and answers with each child's position. The children keep the extent they asked for, so what an arrangement decides is where the space left over goes: Start, End, Top, Bottom and Center keep the children together and put all of it on one side or split it evenly; SpaceBetween, SpaceAround and SpaceEvenly share it out between them; spacedBy holds a fixed gap between adjacent children and places the group as a whole.

spacing is the gap an arrangement holds between two adjacent children, in pixels. A container reserves it before it measures, so it is part of the size the container asks for.

Types

Link copied to clipboard
@Stable
interface Horizontal

Places children along a horizontal axis, resolved against the container's ComponentOrientation.

Link copied to clipboard

An arrangement that reads the same on either axis, so it serves a Row and a Column alike.

Link copied to clipboard
@Stable
interface Vertical

Places children along a vertical axis.

Properties

Link copied to clipboard

Packs the children against the bottom.

Link copied to clipboard

Keeps the children together and puts half the space left over on either side of the group.

Link copied to clipboard

Packs the children against the trailing edge - the right under a left-to-right orientation.

Link copied to clipboard

Gives every child an equal gap of its own, so the gaps at the edges are half the gaps between.

Link copied to clipboard

Splits the space left over into equal gaps between the children, with none at either edge.

Link copied to clipboard

Splits the space left over into equal gaps between the children and at both edges.

Link copied to clipboard

Packs the children against the leading edge - the left under a left-to-right orientation.

Link copied to clipboard

Packs the children against the top.

Functions

Link copied to clipboard

Keeps the children together and places the group as a whole at alignment along the row.

Keeps the children together and places the group as a whole at alignment along the column.

Link copied to clipboard

Holds space pixels between two adjacent children and packs the group against the leading edge. A negative space overlaps them.

Holds space pixels between two adjacent children and places the group as a whole at alignment along the row. A negative space overlaps them.

@Stable
fun spacedBy(space: Int, alignment: Alignment.Vertical): Arrangement.Vertical

Holds space pixels between two adjacent children and places the group as a whole at alignment along the column. A negative space overlaps them.