Alignment

Known direct subclasses
BiasAbsoluteAlignment

An Alignment specified by bias: for example, a bias of -1 represents alignment to the left/top, a bias of 0 will represent centering, and a bias of 1 will represent right/bottom.

BiasAlignment

An Alignment specified by bias: for example, a bias of -1 represents alignment to the start/top, a bias of 0 will represent centering, and a bias of 1 will represent end/bottom.


An interface to calculate the position of a sized box inside an available space. Alignment is often used to define the alignment of a layout inside a parent layout.

Summary

Nested types

fun interface Alignment.Horizontal

An interface to calculate the position of box of a certain width inside an available width.

fun interface Alignment.Vertical

An interface to calculate the position of a box of a certain height inside an available height.

Public functions

IntOffset
align(size: IntSize, space: IntSize, layoutDirection: LayoutDirection)

Calculates the position of a box of size size relative to the top left corner of an area of size space.

Cmn

Public companion properties

Bottom

val Bottom: Alignment.Vertical

BottomCenter

val BottomCenter: Alignment

BottomEnd

val BottomEnd: Alignment

BottomStart

val BottomStart: Alignment

Center

val Center: Alignment

CenterEnd

val CenterEnd: Alignment

CenterHorizontally

val CenterHorizontally: Alignment.Horizontal

CenterStart

val CenterStart: Alignment

CenterVertically

val CenterVertically: Alignment.Vertical

End

val End: Alignment.Horizontal

Start

val Start: Alignment.Horizontal

Top

val Top: Alignment.Vertical

TopCenter

val TopCenter: Alignment

TopEnd

val TopEnd: Alignment

TopStart

val TopStart: Alignment

Public functions

align

fun align(size: IntSize, space: IntSize, layoutDirection: LayoutDirection): IntOffset

Calculates the position of a box of size size relative to the top left corner of an area of size space. The returned offset can be negative or larger than space - size, meaning that the box will be positioned partially or completely outside the area.