Android Auto Fit Button

I just released my first Android library and I’m very excited about that. It’s not a must-to-have library but it’s something that can be very useful in some particular situation when you have constraints coming from other teams (designers, product, …) and that you cannot skip.

Android Auto Fit Button extends the default Button widget but automatically resizes the button text to fit the available inner button space. It takes into consideration the space occupied by drawables, padding, HTML formatting.

The button at the bottom adapts the text to fit the space for english locale and italian locale.

Of course, I’m not suggesting you to use it as your new default Android button widget, but I’m quite sure it could be very useful in some particular layout situations.

Probably an auto fit button doesn’t respect the Android design guidelines because the text can be too small in some scenarios and doesn’t scale up for accessibility needs, but I want to release it anyway because I know for sure that already exists an iOS equivalent and also a Windows Phone equivalent. So use it responsibly ;)

Checkout the source code from here: https://github.com/marcouberti/android-auto-fit-button