Interface

Alignment

An interface to calculate the position of a sized box inside an available space.

Source set: Common
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

Source set: Common
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

Source set: Common
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

Source set: Common
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

Source set: Common
public operator fun plus(other: Vertical): Alignment

Combine this instance's horizontal alignment with other's vertical alignment to create an Alignment.

Vertical

Source set: Common
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

Source set: Common
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

Source set: Common
public operator fun plus(other: Horizontal): Alignment

Combine this instance's vertical alignment with other's horizontal alignment to create an Alignment.

Companion

Source set: Common
public companion object

A collection of common Alignments aware of layout direction.

Properties

TopStart

Source set: Common
@Stable public val TopStart: Alignment = BiasAlignment(-1f, -1f)

TopCenter

Source set: Common
@Stable public val TopCenter: Alignment = BiasAlignment(0f, -1f)

TopEnd

Source set: Common
@Stable public val TopEnd: Alignment = BiasAlignment(1f, -1f)

CenterStart

Source set: Common
@Stable public val CenterStart: Alignment = BiasAlignment(-1f, 0f)

Center

Source set: Common
@Stable public val Center: Alignment = BiasAlignment(0f, 0f)

CenterEnd

Source set: Common
@Stable public val CenterEnd: Alignment = BiasAlignment(1f, 0f)

BottomStart

Source set: Common
@Stable public val BottomStart: Alignment = BiasAlignment(-1f, 1f)

BottomCenter

Source set: Common
@Stable public val BottomCenter: Alignment = BiasAlignment(0f, 1f)

BottomEnd

Source set: Common
@Stable public val BottomEnd: Alignment = BiasAlignment(1f, 1f)

Top

Source set: Common
@Stable public val Top: Vertical = BiasAlignment.Vertical(-1f)

CenterVertically

Source set: Common
@Stable public val CenterVertically: Vertical = BiasAlignment.Vertical(0f)

Bottom

Source set: Common
@Stable public val Bottom: Vertical = BiasAlignment.Vertical(1f)

Start

Source set: Common
@Stable public val Start: Horizontal = BiasAlignment.Horizontal(-1f)

CenterHorizontally

Source set: Common
@Stable public val CenterHorizontally: Horizontal = BiasAlignment.Horizontal(0f)

End

Source set: Common
@Stable public val End: Horizontal = BiasAlignment.Horizontal(1f)
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: