https://kotlinlang.org logo
#compose-android
Title
# compose-android
n

Nick

11/14/2023, 1:41 AM
hi all--I have a big wall of static disclosure text in my Android app that has various formatting applied through it--it’s been straightforward to use
buildAnnotatedString
to get bold, underline, and italics set up. I can’t seem to find a way to get bulleted lists to perform correctly where the bullet character’s displayed and line wraps indent correctly. Thanks in advance for your help.
e

ephemient

11/14/2023, 2:01 AM
hmm. maybe
Copy code
ParagraphStyle(
    indent = TextIndent(firstLine = 0.sp, restLine = indent),
    ...
)
and replace the bullet with
Copy code
InlineTextContent(
    placeholder = Placeholder(
        width = indent,
        height = ...,
        placeholderVerticalAlign = TextCenter,
    ),
    children = {
        // manually draw bullet at end
    }
}
?
n

Nick

11/14/2023, 2:03 AM
I'll give it a try. Thanks!
a

ascii

11/14/2023, 6:15 AM
I've applied
restLine = 9.05.sp
which was obtained experimentally. Seems to work ok for Roboto across all sizes.
🙏 1
n

Nick

11/14/2023, 6:31 PM
worked like a charm--thanks @ephemient. Still seems harder than it should be, though, right?
2 Views