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

LineHeightStyle.Trim.Companion

public static class LineHeightStyle.Trim.Companion


Summary

Public methods

static final @NonNull LineHeightStyle.Trim

Trim the space that would be added to the top of the first line and bottom of the last line as a result of the line height.

static final @NonNull LineHeightStyle.Trim

Trim the space that would be added to the top of the first line as a result of the line height.

static final @NonNull LineHeightStyle.Trim

Trim the space that would be added to the bottom of the last line as a result of the line height.

static final @NonNull LineHeightStyle.Trim

Do not trim first line top or last line bottom.

Public methods

getBoth

public static final @NonNull LineHeightStyle.Trim getBoth()

Trim the space that would be added to the top of the first line and bottom of the last line as a result of the line height. This feature is available only when PlatformParagraphStyle.includeFontPadding is false.

For example, when line height is 3.em, and Alignment is Alignment.Center, the first and last line has 2.em height and the height from first line baseline to second line baseline is still 3.em:

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

getFirstLineTop

public static final @NonNull LineHeightStyle.Trim getFirstLineTop()

Trim the space that would be added to the top of the first line as a result of the line height. Single line text is both the first and last line. This feature is available only when PlatformParagraphStyle.includeFontPadding is false.

For example, when line height is 3.em, and Alignment is Alignment.Center, the first line has 2.em height and the height from first line baseline to second line baseline is still 3.em:

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

getLastLineBottom

public static final @NonNull LineHeightStyle.Trim getLastLineBottom()

Trim the space that would be added to the bottom of the last line as a result of the line height. Single line text is both the first and last line. This feature is available only when PlatformParagraphStyle.includeFontPadding is false.

For example, when line height is 3.em, and Alignment is Alignment.Center, the last line has 2.em height and the height from first line baseline to second line baseline is still 3.em:

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

getNone

public static final @NonNull LineHeightStyle.Trim getNone()

Do not trim first line top or last line bottom.

For example, when line height is 3.em, and Alignment is Alignment.Center, the first line height, last line height and the height from first line baseline to second line baseline are 3.em:

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