I've been experiencing very weird behavior of AppCompatTextView
's autoSizeTextType
.
I found where the problem is but i don't get it at all.
There is a AppCompatTextView
in a ConstraintLayout
. it's only child of the XML.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/testView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Hello World!"
android:padding="5dp"
app:autoSizeMaxTextSize="10dp"
app:autoSizeMinTextSize="7dp"
app:autoSizeTextType="uniform"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
and the result is like this below.
Can you see it? i didn't make the hint horizontally to show like that.
But if i change the 7dp with 10dp, the problem will be gone.
But i can't do that because the autoSizeMaxTextSize
and autoSizeMinTextSize
should not be the same.
What's happening here now? is it a bug?
Replace app with android
app will assign values from values.xml
android will assign values from attrs.xml