当前位置: 动力学知识库 > 问答 > 编程问答 >

android - 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.

网友答案:

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.

网友答案:

You can use AutoFitTextView for better result . A TextView that automatically fit its font and line count based on its available size and content.

分享给朋友:
您可能感兴趣的文章:
随机阅读: