ssomai / ScalableLayout

Scalable Layout For Android
Apache License 2.0
270 stars 87 forks source link

Size text to fit TextView in ScaleableLayout #36

Open alexandre-g opened 8 years ago

alexandre-g commented 8 years ago

Hi there, thanks for the great layout. Works well.

I have a slight problem with localisations though - since the strings in different languages are different lengths, I need to set a different text size for each language. Is there a way to make text shrink/expand to fit the TextView?

I have a custom TextView implementation that does this and works well when used outside of the ScalableLayout, but does not work when placed within - the ScalableLayout sizing logic seems to have the final word.

If there is no way to do this now, I think it would be a great addition as you often care more about what area the text occupies rather then the font size.

ssomai commented 8 years ago

Thank you for good issue.

I have implemented sample layout like this for fitting text size to the TextView. https://github.com/ssomai/ScalableLayout/blob/master/sample_scalablelayout/src/main/res/layout/activity_main.xml I imported android-autofittextview https://github.com/grantland/android-autofittextview

If I misunderstood, please re-issue. :) Thank you.