{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

LineHeightStyle.Alignment.Companion

public static class LineHeightStyle.Alignment.Companion


Summary

Public methods

static final @NonNull LineHeightStyle.Alignment

Align the line to the bottom of the space reserved for that line.

static final @NonNull LineHeightStyle.Alignment

Align the line to the center of the space reserved for the line.

static final @NonNull LineHeightStyle.Alignment

Align the line proportional to the ascent and descent values of the line.

static final @NonNull LineHeightStyle.Alignment

Align the line to the top of the space reserved for that line.

Public methods

getBottom

public static final @NonNull LineHeightStyle.Alignment getBottom()

Align the line to the bottom of the space reserved for that line. This means that all extra space as a result of line height is applied to the top of the line. When the provided line height value is smaller than the actual line height, the line will still be aligned to the bottom, therefore the required difference will be subtracted from the top of the line.

For example, when line height is 3.em, the lines are aligned to the bottom of 3.em height:

+--------+
|        |
|        |
| Line1  |
|--------|
|        |
|        |
| Line2  |
+--------+

getCenter

public static final @NonNull LineHeightStyle.Alignment getCenter()

Align the line to the center of the space reserved for the line. This configuration distributes additional space evenly between top and bottom of the line.

For example, when line height is 3.em, the lines are aligned to the center of 3.em height:

+--------+
|        |
| Line1  |
|        |
|--------|
|        |
| Line2  |
|        |
+--------+

getProportional

public static final @NonNull LineHeightStyle.Alignment getProportional()

Align the line proportional to the ascent and descent values of the line. For example if ascent is 8 units of length, and descent is 2 units; an additional space of 10 units will be distributed as 8 units to top, and 2 units to the bottom of the line. This is the default behavior.

getTop

public static final @NonNull LineHeightStyle.Alignment getTop()

Align the line to the top of the space reserved for that line. This means that all extra space as a result of line height is applied to the bottom of the line. When the provided line height value is smaller than the actual line height, the line will still be aligned to the top, therefore the required difference will be subtracted from the bottom of the line.

For example, when line height is 3.em, the lines are aligned to the top of 3.em height:

+--------+
| Line1  |
|        |
|        |
|--------|
| Line2  |
|        |
|        |
+--------+