Is there a way to avoid it?
If my text is "Blablabla" and it doesn't fit in a square, I don't want to have something like:
Blabla-
bla
I want "Blablabla" with a smaller font size. Is there a way to control whether the autosizing TextView will split up words or not?
Here's an example of the issue:
The minimum text size there is 1sp
, so it's pretty clear the word could fit with a decreased text size.
It seems this has been reported: https://issuetracker.google.com/issues/38468964
autoSizeMaxTextSize is the maximum size of textview it will take autoSizeMinTextSize is the minimum size of textview it will take and autoSizeStepGranularity is the size of each step.
You are applying to your TextView a compound Drawable on the right.. to make the three dots appear in this scenario, you have to apply a android:drawablePadding="{something}dp" attribute to the TextView as well. Hope it helps!
How do I Auto Resize TextView? To use preset sizes to set up the autosizing of TextView in XML, use the android namespace and set the following attributes: Set the autoSizeText attribute to either none or uniform. Set the autoSizePresetSizes attribute to an array of preset sizes.
I came here having the same issues with two-line text as others. The only thing that works for me is this: https://github.com/AndroidDeveloperLB/AutoFitTextView
It's not as convenient as adding a couple lines to your layout, but it works in situations where Android's auto size doesn't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With