Reputation: 826
I'm working right now with AnnotedStrings to create this Text with two different text styles:
I'm setting up this label using a SpanStyle. How do I setup the line height this way? Because SpanStyle is missing this attribute.
Upvotes: 7
Views: 2440
Reputation: 363845
You can use the ParagraphStyle
to define the lineHeight
and the lineHeightStyle
.
Something like:
buildAnnotatedString {
withStyle(style = ParagraphStyle(lineHeight = 60.sp)) {
withStyle(style = SpanStyle(color = Color.Blue, fontSize= 60.sp)) {
append("Hello")
}
append("Compose")
}
}
Upvotes: 15