Google is committed to advancing racial equity for Black communities. See how.

Arrangement

@Immutable object Arrangement
kotlin.Any
   ↳ androidx.compose.foundation.layout.Arrangement

Used to specify the arrangement of the layout's children in Row or Column in the main axis direction (horizontal and vertical, respectively).

Summary

Nested classes
abstract

Used to specify the horizontal arrangement of the layout's children in a Row.

abstract

Used to specify the horizontal arrangement of the layout's children in a Row, or the vertical arrangement of the layout's children in a Column.

abstract

Used to specify the vertical arrangement of the layout's children in a Column.

Public methods
Arrangement.Horizontal

Place children horizontally one next to the other and align the obtained group according to an alignment.

Arrangement.Vertical

Place children vertically one next to the other and align the obtained group according to an alignment.

Arrangement.HorizontalOrVertical
spacedBy(space: Dp)

Place children such that each two adjacent ones are spaced by a fixed space distance across the main axis.

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

Place children horizontally such that each two adjacent ones are spaced by a fixed space distance.

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

Place children vertically such that each two adjacent ones are spaced by a fixed space distance.

Properties
Arrangement.Vertical

Place children vertically such that they are as close as possible to the bottom of the main axis.

Arrangement.HorizontalOrVertical

Place children such that they are as close as possible to the middle of the main axis.

Arrangement.Horizontal

Place children horizontally such that they are as close as possible to the end of the main axis.

Arrangement.HorizontalOrVertical

Place children such that they are spaced evenly across the main axis, including free space before the first child and after the last child, but half the amount of space existing otherwise between two consecutive children.

Arrangement.HorizontalOrVertical

Place children such that they are spaced evenly across the main axis, without free space before the first child or after the last child.

Arrangement.HorizontalOrVertical

Place children such that they are spaced evenly across the main axis, including free space before the first child and after the last child.

Arrangement.Horizontal

Place children horizontally such that they are as close as possible to the beginning of the main axis.

Arrangement.Vertical

Place children vertically such that they are as close as possible to the top of the main axis.

Public methods

aligned

fun aligned(alignment: Alignment.Horizontal): Arrangement.Horizontal

Place children horizontally one next to the other and align the obtained group according to an alignment.

Parameters
alignment: Alignment.Horizontal The alignment of the children inside the parent.

aligned

fun aligned(alignment: Alignment.Vertical): Arrangement.Vertical

Place children vertically one next to the other and align the obtained group according to an alignment.

Parameters
alignment: Alignment.Vertical The alignment of the children inside the parent.

spacedBy

fun spacedBy(space: Dp): Arrangement.HorizontalOrVertical

Place children such that each two adjacent ones are spaced by a fixed space distance across the main axis. The spacing will be subtracted from the available space that the children can occupy.

Parameters
space: Dp The space between adjacent children.

spacedBy

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

Place children horizontally such that each two adjacent ones are spaced by a fixed space distance. The spacing will be subtracted from the available width that the children can occupy. An alignment can be specified to align the spaced children horizontally inside the parent, in case there is empty width remaining.

Parameters
space: Dp The space between adjacent children.
alignment: Alignment.Horizontal The alignment of the spaced children inside the parent.

spacedBy

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

Place children vertically such that each two adjacent ones are spaced by a fixed space distance. The spacing will be subtracted from the available height that the children can occupy. An alignment can be specified to align the spaced children vertically inside the parent, in case there is empty height remaining.

Parameters
space: Dp The space between adjacent children.
alignment: Alignment.Vertical The alignment of the spaced children inside the parent.

Properties

Bottom

val Bottom: Arrangement.Vertical

Place children vertically such that they are as close as possible to the bottom of the main axis.

Center

val Center: Arrangement.HorizontalOrVertical

Place children such that they are as close as possible to the middle of the main axis.

End

val End: Arrangement.Horizontal

Place children horizontally such that they are as close as possible to the end of the main axis.

SpaceAround

val SpaceAround: Arrangement.HorizontalOrVertical

Place children such that they are spaced evenly across the main axis, including free space before the first child and after the last child, but half the amount of space existing otherwise between two consecutive children.

SpaceBetween

val SpaceBetween: Arrangement.HorizontalOrVertical

Place children such that they are spaced evenly across the main axis, without free space before the first child or after the last child.

SpaceEvenly

val SpaceEvenly: Arrangement.HorizontalOrVertical

Place children such that they are spaced evenly across the main axis, including free space before the first child and after the last child.

Start

val Start: Arrangement.Horizontal

Place children horizontally such that they are as close as possible to the beginning of the main axis.

Top

val Top: Arrangement.Vertical

Place children vertically such that they are as close as possible to the top of the main axis.