My Profile Photo

Andrea Maglie


Software Engineer, guitar player. Founder of GDG (Google Developer Group) Venice.


Android Auto Fit TextView

Android framework provides no support for creating a TextView that can fit its content to its size.

There are some libraries out there that try to solve this problem, like:

But no one of them seems to work in every situation. Looking into stackoverflow I’ve come to this post which seems to hold the best working answer that I’ve tried.

Except when I’ve tried to use it when textAllCaps=”true”. The solution to this issue has already been reported in one of the comments. So I put up all togheter, and the result is the following AutoResizeTextView implementation:

comments powered by Disqus