4

How do I wrap text around an image or a composable?
Something similar to FlowTextView in Jetpack Compose.

I am wondering if there is a possibility to leave a certain space free so that if the text is too long it breaks a line and writing continues underneath the free space completely normally without the space being overwritten.

I have this:

enter image description here

I want to do this:

enter image description here

I try to do this with compose for desktop but should be the same as with android jetpack compose.
I do not know if it is, for now, possible but I can't find a way to manipulate the Text composable.
Found PlaceHolder and TextLayoutInput but i don't know how to use it. Maybe impossible.

Abhimanyu
  • 11,351
  • 7
  • 51
  • 121
Zen1000
  • 147
  • 9
  • Have edited the question with a link to FlowTextView. You can use this library and android view in compose to achieve what you want in android. But not sure how it can be done in desktop, hence leaving a comment and not an answer. – Abhimanyu Dec 29 '21 at 02:06
  • https://youtu.be/R430EqT-IaQ this video explains it very well – RaBaKa 78 Dec 29 '21 at 03:29
  • @RaBaKa78 - Video is unavailable. – caveman Sep 01 '22 at 09:41

2 Answers2

1

Putting images inside text can be done using AnnotatedString and inlineContent parameter of Text Composable.

How adding ImageSpan in jetpack compose Text

paulfranco
  • 84
  • 1
  • 3
1

Kind of an old question but in Compose you can use the Text Flow dependency. It has with support for wrapping text around any composable and it also allows for fun animations!