grantland / android-autofittextview

A TextView that automatically resizes text to fit perfectly within its bounds.
Apache License 2.0
4.27k stars 688 forks source link

Add height support (and upgrade to gradle plugin 0.9) #7

Closed drbild closed 10 years ago

drbild commented 10 years ago

Here's an attempt at supporting both maxlines and width/height (as determined by the view layout system) using a StaticLayout.

Like the previous version, this fails if the line spacing multiplier and addition are set to anything other than 1.0 and 0.0. (The constructor does not use the setter and the getters weren't added until API 16, so retrieving the initial values in a supported fashion is "impossible".)

This works for me, but isn't heavily tested. And you may have some other ideas about how to handle height.

drbild commented 10 years ago

Ignore this. It doesn't properly increase the text size when the length decreases.