0

I have a TextView that is going to display one single sentence.

This sentence could be shorter or longer, up to 200 characters for example, but could be more.

I am trying to fit the size of the TextView dynamically according to the text that will be written, but nothing that I have found so far works for me.

I have tried the Auto Scale TextView Text to Fit within Bounds but it's not perfect for my needs as it adapts the text to a very small size and writing two lines, leaving a huge blank space on top and under the text.

EDIT: I see that in phones this solution works perfect. However, when I test in a tablet, it does not increase the text size to fill as much as possible. I am not sure, but I think it only decreases to fit. Please, correct me if I am wrong.

Has somebody tried a different solution?

Community
  • 1
  • 1
garfield185
  • 213
  • 2
  • 11
  • Do you think it could be possible to accommodate full text without re-sizing? – Paresh Mayani Jul 22 '13 at 13:14
  • can't you use WRAP_CONTENT??? – Armaan Stranger Jul 22 '13 at 13:15
  • I want to fill as much space as possible, without leaving blank spaces. And no Armaan, I cannot use WRAP_CONTENT as it fits the textview's size to the content. What I want is to FILL_PARENT and then, adjust the text size to the maximum, filling all the space. Without trimming the text because lack of space, of course – garfield185 Jul 22 '13 at 13:38

1 Answers1

0

You could try the AutoScale TextView third-party widget.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491