Recently there was a question on kotlinlang slack about using Brush in AnnotatedString spans.
There was a confusion about why the gradient renders differently when applied on different parts of text.
Need to style text in Jetpack Compose? The AnnotatedString is a simple option, but it often involves a lot of boilerplate code.
You can use the AnnotatedString.fromHtml function to avoid manual text styling. The string can be stored in resources or in a separate file.
#JetpackCompose
For the curious: we parse the markdown with commonmark-java and display it using a Compose AnnotatedString.
The hardest parts were properly integrating with localization and string interpolation and keeping things performant
In Jetpack Compose 1.7.0-alpha07, the "parseHtml" function was renamed to "fromHtml." It allows you to convert a string with HTML tags into AnnotatedString. Use this method for creating AnnotatedString whenever it's suitable.
#AndroidDev#JetpackCompose
🤡 Julia has `printstyled()` with colors and bold-italic format options.
We can also talk about AnnotatedString and StyledStrings later in the next release 🎈🙃
Something new is coming soon💫
#julialang@JuliaLanguage
From 1.7.0-alpha06 release notes;
Added parseAsHtml method for styled strings: it allows to convert a string marked with HTML tags into AnnotatedString.
Don't sleep on this!
Are you looking to style text in Jetpack Compose? The AnnotatedString can help:
• Combine styles into a single Text component
• Highlight search results
• and much more.
Read more 🔽
#JetpackCompose#AndroidDev