This page describes how to configure your text layout with parameters like
maxLines
and overflow
.
Limit visible lines
To limit the number of visible lines in a Text
composable, set the maxLines
parameter:
@Composable fun LongText() { Text("hello ".repeat(50), maxLines = 2) }
Indicate text overflow
When limiting a long text, you may want to indicate a TextOverflow
,
which is only shown if the displayed text is truncated. To do so, set the
textOverflow
parameter:
@Composable fun OverflowedText() { Text("Hello Compose ".repeat(50), maxLines = 2, overflow = TextOverflow.Ellipsis) }
No recommendations at this time.
Try signing in to your Google account.