Find max characters can fit in one line of Android Jetpack compose Text

787 Views Asked by At

I want to find the total number of characters that can fit in one line of a current Jetpack compose Text

Any field where I can get this information. Thanks

1

There are 1 best solutions below

0
MarianD On

You probably assume that the Text() composable is some placeholder (box) with fixed dimensions

enter image description here

then you place some text into it

enter image description here

and ask us, how many characters you may use to fit this placeholder.

But things work the other way:

  1. There is no Text() composable without text string in it.
  2. The Text() composable occupy as much space, as it can.

So, for example, it occupies the whole screen, if there are no other elements, in spite of the text consist only of 1 character.

So your question in its current form has no sense.

You probably wanted to solve one thing, but ask us about the other – see What is the X-Y problem? and possibly edit your question.