Paragraph
Deprecated Font.ResourceLoader is deprecated, instead pass FontFamily.Resolver
fun Paragraph(
text: String,
style: TextStyle,
spanStyles: List<AnnotatedString.Range<SpanStyle>> = listOf(),
placeholders: List<AnnotatedString.Range<Placeholder>> = listOf(),
maxLines: Int = DefaultMaxLines,
ellipsis: Boolean = false,
width: Float,
density: Density,
resourceLoader: Font.ResourceLoader,
): Paragraph
Lays out a given text
with the given constraints. A paragraph is a text that has a single
ParagraphStyle
.
If the style
does not contain any androidx.compose.ui.text.style.TextDirection
,
androidx.compose.ui.text.style.TextDirection.Content
is used as the default value.
Parameters
text | the text to be laid out |
style | the TextStyle to be applied to the whole text |
spanStyles | SpanStyle s to be applied to parts of text |
placeholders | a list of placeholder metrics which tells Paragraph where should be left blank to leave space for inline elements. |
maxLines | the maximum number of lines that the text can have |
ellipsis | whether to ellipsize text, applied only when maxLines is set |
width | how wide the text is allowed to be |
density | density of the device |
resourceLoader | Font.ResourceLoader to be used to load the font given in SpanStyle s |
Deprecated Paragraph that takes maximum allowed width is deprecated, pass constraints instead.
fun Paragraph(
text: String,
style: TextStyle,
width: Float,
density: Density,
fontFamilyResolver: FontFamily.Resolver,
spanStyles: List<AnnotatedString.Range<SpanStyle>> = listOf(),
placeholders: List<AnnotatedString.Range<Placeholder>> = listOf(),
maxLines: Int = DefaultMaxLines,
ellipsis: Boolean = false,
): Paragraph
Lays out a given text
with the given constraints. A paragraph is a text that has a single
ParagraphStyle
.
If the style
does not contain any androidx.compose.ui.text.style.TextDirection
,
androidx.compose.ui.text.style.TextDirection.Content
is used as the default value.
Parameters
text | the text to be laid out |
style | the TextStyle to be applied to the whole text |
width | how wide the text is allowed to be |
density | density of the device |
fontFamilyResolver | FontFamily.Resolver to be used to load the font given in SpanStyle s |
spanStyles | SpanStyle s to be applied to parts of text |
placeholders | a list of placeholder metrics which tells Paragraph where should be left blank to leave space for inline elements. |
maxLines | the maximum number of lines that the text can have |
ellipsis | whether to ellipsize text, applied only when maxLines is set |
Deprecated Paragraph that takes
ellipsis: Boolean
is deprecated, pass TextOverflow instead.
fun Paragraph(
text: String,
style: TextStyle,
constraints: Constraints,
density: Density,
fontFamilyResolver: FontFamily.Resolver,
spanStyles: List<AnnotatedString.Range<SpanStyle>> = listOf(),
placeholders: List<AnnotatedString.Range<Placeholder>> = listOf(),
maxLines: Int = DefaultMaxLines,
ellipsis: Boolean = false,
): Paragraph
Lays out a given text
with the given constraints. A paragraph is a text that has a single
ParagraphStyle
.
If the style
does not contain any androidx.compose.ui.text.style.TextDirection
,
androidx.compose.ui.text.style.TextDirection.Content
is used as the default value.
Parameters
text | the text to be laid out |
style | the TextStyle to be applied to the whole text |
constraints | how wide and tall the text is allowed to be. Constraints.maxWidth will define the width of the Paragraph. Constraints.maxHeight helps defining the number of lines that fit with ellipsis is true. Minimum components of the Constraints object are no-op. |
density | density of the device |
fontFamilyResolver | FontFamily.Resolver to be used to load the font given in SpanStyle s |
spanStyles | SpanStyle s to be applied to parts of text |
placeholders | a list of placeholder metrics which tells Paragraph where should be left blank to leave space for inline elements. |
maxLines | the maximum number of lines that the text can have |
ellipsis | whether to ellipsize text, applied only when maxLines is set |
fun Paragraph(
text: String,
style: TextStyle,
constraints: Constraints,
density: Density,
fontFamilyResolver: FontFamily.Resolver,
spanStyles: List<AnnotatedString.Range<SpanStyle>> = listOf(),
placeholders: List<AnnotatedString.Range<Placeholder>> = listOf(),
maxLines: Int = DefaultMaxLines,
overflow: TextOverflow = TextOverflow.Clip,
): Paragraph
Lays out a given text
with the given constraints. A paragraph is a text that has a single
ParagraphStyle
.
If the style
does not contain any androidx.compose.ui.text.style.TextDirection
,
androidx.compose.ui.text.style.TextDirection.Content
is used as the default value.
Parameters
text | the text to be laid out |
style | the TextStyle to be applied to the whole text |
constraints | how wide and tall the text is allowed to be. Constraints.maxWidth will define the width of the Paragraph. Constraints.maxHeight helps defining the number of lines that fit with ellipsis is true. Minimum components of the Constraints object are no-op. |
density | density of the device |
fontFamilyResolver | FontFamily.Resolver to be used to load the font given in SpanStyle s |
spanStyles | SpanStyle s to be applied to parts of text |
placeholders | a list of placeholder metrics which tells Paragraph where should be left blank to leave space for inline elements. |
maxLines | the maximum number of lines that the text can have |
overflow | specifies how visual overflow should be handled |
Deprecated Paragraph that takes maximum allowed width is deprecated, pass constraints instead.
fun Paragraph(
paragraphIntrinsics: ParagraphIntrinsics,
maxLines: Int = DefaultMaxLines,
ellipsis: Boolean = false,
width: Float,
): Paragraph
Lays out the text in ParagraphIntrinsics
with the given constraints. A paragraph is a text that
has a single ParagraphStyle
.
Parameters
paragraphIntrinsics | ParagraphIntrinsics instance |
maxLines | the maximum number of lines that the text can have |
ellipsis | whether to ellipsize text, applied only when maxLines is set |
width | how wide the text is allowed to be |
Deprecated Paragraph that takes ellipsis: Boolean is deprecated, pass TextOverflow instead.
fun Paragraph(
paragraphIntrinsics: ParagraphIntrinsics,
constraints: Constraints,
maxLines: Int = DefaultMaxLines,
ellipsis: Boolean = false,
): Paragraph
Lays out the text in ParagraphIntrinsics
with the given constraints. A paragraph is a text that
has a single ParagraphStyle
.
Parameters
paragraphIntrinsics | ParagraphIntrinsics instance |
constraints | how wide and tall the text is allowed to be. Constraints.maxWidth will define the width of the Paragraph. Constraints.maxHeight helps defining the number of lines that fit with ellipsis is true. Minimum components of the Constraints object are no-op. |
maxLines | the maximum number of lines that the text can have |
ellipsis | whether to ellipsize text, applied only when maxLines is set |
fun Paragraph(
paragraphIntrinsics: ParagraphIntrinsics,
constraints: Constraints,
maxLines: Int = DefaultMaxLines,
overflow: TextOverflow = TextOverflow.Clip,
): Paragraph
Lays out the text in ParagraphIntrinsics
with the given constraints. A paragraph is a text that
has a single ParagraphStyle
.
Parameters
paragraphIntrinsics | ParagraphIntrinsics instance |
constraints | how wide and tall the text is allowed to be. Constraints.maxWidth will define the width of the Paragraph. Constraints.maxHeight helps defining the number of lines that fit with ellipsis is true. Minimum components of the Constraints object are no-op. |
maxLines | the maximum number of lines that the text can have |
overflow | specifies how visual overflow should be handled |