As we know, AnnotatedString in JetpackCompose has provided some API of Android's SpannedString.
but I didn't find any way/workaround to inline ImageSpan to a Text (except using AndroidView)
As we know, AnnotatedString in JetpackCompose has provided some API of Android's SpannedString.
but I didn't find any way/workaround to inline ImageSpan to a Text (except using AndroidView)
Copyright © 2021 Jogjafile Inc.
Putting images inside text can be done using
AnnotatedStringandinlineContentparameter ofTextComposable.buildAnnotatedString { ... }we need to define some id for our inline content usingappendInlineContent(id = ...)TextComposable ininlineContentparameter we provide a map matching this id toInlineTextContent()object.You can basically put any content there as long as you can define its size up-front in
Placeholder.Here is how it looks with an
Imageput in the middle of the text: