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

Bug: text get truncated even though there is a lot of space left, and characters can go to next line #59

Open AndroidDeveloperLB opened 8 years ago

AndroidDeveloperLB commented 8 years ago

On some cases, the letter of one word goes to the next line.

Here's a sample case:

    <me.grantland.widget.AutofitTextView
        android:id="@+id/output_autofit"
        android:layout_width="286dp"
        android:layout_height="305dp"
        android:maxLines="3"
        android:text="content text sample"         />

mAutofitOutput = (AutofitTextView) findViewById(R.id.output_autofit);
mAutofitOutput.setMaxTextSize(1000);

BTW, there is no "maxTextSize" attribute, so I had to do it via code instead.

The result (modified the sample) : device-2016-02-09-111057

Not only that, but for the same case, when increasing the width of the textView, the text itself gets truncated. Here's what happens when I set the width to match_parent :

device-2016-02-09-111611