androidx.compose.foundation.layout

Arrangement

Object · from org.jetbrains.compose.foundation:foundation-layout:1.12.2

Arrangement sets where children go along the main direction of a layout: horizontally in a Row, vertically in a Column or LazyColumn.

Start         [A][B][C]
Center              [A][B][C]
End                       [A][B][C]
SpaceBetween  [A]       [B]       [C]
SpaceAround     [A]     [B]     [C]
SpaceEvenly      [A]    [B]    [C]
spacedBy(8)   [A] [B] [C]

You only see a difference when the layout is bigger than its children, for example with Modifier.fillMaxWidth().

spacedBy is the one you use most: the same gap between all children. spacedBy(8.dp, Alignment.CenterHorizontally) also centers them.

object Arrangement

Properties

Start

val Start

Children at the start. In right-to-left languages, that is the right.

End

val End

Children at the end.

Top

val Top

Children at the top. For columns.

Bottom

val Bottom

Children at the bottom. For columns.

Center

val Center

Children in the middle.

SpaceEvenly

val SpaceEvenly

Free space shared evenly, the edges included.

SpaceBetween

val SpaceBetween

The first and last child at the edges, the free space shared between the others.

SpaceAround

val SpaceAround

Free space shared around each child. The edges get half a gap.

Functions

spacedBy

fun spacedBy(space: Dp): HorizontalOrVertical

A fixed gap between children. Optionally also where to put the group.

fun spacedBy(space: Dp, alignment: Alignment.Horizontal): Horizontal

A fixed gap between children. Optionally also where to put the group.

fun spacedBy(space: Dp, alignment: Alignment.Vertical): Vertical

A fixed gap between children. Optionally also where to put the group.

aligned

fun aligned(alignment: Alignment.Horizontal): Horizontal

Children packed together at one alignment, like aligned(Alignment.End).

fun aligned(alignment: Alignment.Vertical): Vertical

Children packed together at one alignment, like aligned(Alignment.End).

Nested types