TextAlign

Class

Common
value class TextAlign internal constructor(val value: Int)

Defines how to align text horizontally. TextAlign controls how text aligns in the space it appears.

Properties

Common
val isSpecified: Boolean

Returns true if this baseline shift is not TextAlign.Unspecified.

Companion Object

Properties

Common
val Left = TextAlign(1)

Align the text on the left edge of the container.

Common
val Right = TextAlign(2)

Align the text on the right edge of the container.

Common
val Center = TextAlign(3)

Align the text in the center of the container.

Common
val Justify = TextAlign(4)

Stretch lines of text that end with a soft line break to fill the width of the container.

Lines that end with hard line breaks are aligned towards the Start edge.

Common
val Start = TextAlign(5)

Align the text on the leading edge of the container.

For Left to Right text (ResolvedTextDirection.Ltr), this is the left edge.

For Right to Left text (ResolvedTextDirection.Rtl), like Arabic, this is the right edge.

Common
val End = TextAlign(6)

Align the text on the trailing edge of the container.

For Left to Right text (ResolvedTextDirection.Ltr), this is the right edge.

For Right to Left text (ResolvedTextDirection.Rtl), like Arabic, this is the left edge.

Common
val Unspecified = TextAlign(0)

This represents an unset value, a usual replacement for "null" when a primitive value is desired.

Methods

Common
fun values(): List<TextAlign>

Return a list containing all possible values of TextAlign.

Common
fun valueOf(value: Int): TextAlign

Creates a TextAlign from the given integer value. This can be useful if you need to serialize/deserialize TextAlign values.

Parameters

valueThe integer representation of the TextAlign.