public interface Alignment
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.
Functions
align
public 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.
Members
Horizontal
public interface Horizontal
An interface to calculate the position of box of a certain width inside an available width. Alignment.Horizontal is often used to define the horizontal alignment of a layout inside a parent layout.
Functions
align
public fun align(size: Int, space: Int, layoutDirection: LayoutDirection): Int
Calculates the horizontal position of a box of width size relative to the left side of an area of width 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.
plus
public operator fun plus(other: Vertical): Alignment
Combine this instance's horizontal alignment with other's vertical alignment to create an Alignment.
Vertical
public interface Vertical
An interface to calculate the position of a box of a certain height inside an available height. Alignment.Vertical is often used to define the vertical alignment of a layout inside a parent layout.
Functions
align
public fun align(size: Int, space: Int): Int
Calculates the vertical position of a box of height size relative to the top edge of an area of height 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.
plus
public operator fun plus(other: Horizontal): Alignment
Combine this instance's vertical alignment with other's horizontal alignment to create an Alignment.
Companion
public companion object
A collection of common Alignments aware of layout direction.
Properties
TopStart
@Stable public val TopStart: Alignment = BiasAlignment(-1f, -1f)
TopCenter
@Stable public val TopCenter: Alignment = BiasAlignment(0f, -1f)
TopEnd
@Stable public val TopEnd: Alignment = BiasAlignment(1f, -1f)
CenterStart
@Stable public val CenterStart: Alignment = BiasAlignment(-1f, 0f)
Center
@Stable public val Center: Alignment = BiasAlignment(0f, 0f)
CenterEnd
@Stable public val CenterEnd: Alignment = BiasAlignment(1f, 0f)
BottomStart
@Stable public val BottomStart: Alignment = BiasAlignment(-1f, 1f)
BottomCenter
@Stable public val BottomCenter: Alignment = BiasAlignment(0f, 1f)
BottomEnd
@Stable public val BottomEnd: Alignment = BiasAlignment(1f, 1f)
Top
@Stable public val Top: Vertical = BiasAlignment.Vertical(-1f)
CenterVertically
@Stable public val CenterVertically: Vertical = BiasAlignment.Vertical(0f)
Bottom
@Stable public val Bottom: Vertical = BiasAlignment.Vertical(1f)
Start
@Stable public val Start: Horizontal = BiasAlignment.Horizontal(-1f)
CenterHorizontally
@Stable public val CenterHorizontally: Horizontal = BiasAlignment.Horizontal(0f)
End
@Stable public val End: Horizontal = BiasAlignment.Horizontal(1f)