Created
October 30, 2023 07:42
-
-
Save mirjalal/8e281cdbcca9dba351a95d0a823afb3c to your computer and use it in GitHub Desktop.
bullet list for compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val htmlString = stringResource(id = R.string.html_string) | |
val bullet = "\u2022" | |
val messages = HtmlCompat.fromHtml(htmlString, HtmlCompat.FROM_HTML_MODE_COMPACT).split('\n').toMutableList() | |
messages.removeIf { it.isEmpty() } | |
Text( | |
buildAnnotatedString { | |
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) { | |
append(messages.removeFirst()) | |
} | |
messages.forEach { | |
withStyle(style = ParagraphStyle(textIndent = TextIndent(restLine = 12.sp))) { | |
append(bullet) | |
append("\t\t") | |
append(it) | |
} | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment