Gershon Papi
Gershon Papi

Reputation: 5126

Changing text's size according to TextView

Hi guys I've wondered if I could resize the TextView's text in order to make it fit withing the text view.
I want the text view to have a default text size, but in case the text is too long and requires more text than the TextView could offer, the text size should get smaller.

I've seen this answer which is awesome, but it's also from 2013, so I've wondered if there's a simpler way of doing this. Android keeps changing and evolving so I just wanted to make sure there's no easier solution first.

Upvotes: 0

Views: 61

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75798

You can use AutoFitTextView for better result .

A TextView that automatically fit its font and line count based on its available size and content.

Upvotes: 2

Moonbloom
Moonbloom

Reputation: 7928

There is no built-in way of achieving this in Android, so you'll have to resort to 3rd party classes and libraries to fix your problem (Like the one you linked)

I have tried a few different classes i found from googling around about 6 months ago, but i never found a 100% working solution, there were always some little kinks or flaws in my experience.

Upvotes: 1

Related Questions