In my activity.xml, I have two AppCompatTextView that looks like this:
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/user_full_name_text_view"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/roboto_bold"
android:maxLines="1"
android:text="@string/full_name"
android:textColor="@android:color/white"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toTopOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/profile_image"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/user_name_text_view"
android:layout_width="0dp"
android:layout_height="20dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/roboto"
android:maxLines="1"
android:text="@string/username"
android:textColor="@android:color/white"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toTopOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="@+id/user_view"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/user_full_name_text_view"
app:layout_constraintTop_toBottomOf="@+id/user_full_name_text_view"
app:layout_constraintVertical_bias="0.0" />
In my design tab, this part of the activity looks like this:
Now that looks correct as the text has correctly auto sized to fill the height of the first AppCompatTextView. However, when I run my app on mobile, it looks like this:
Why is the text not auto sizing? How do I fix this so that way the text fills the entire width and height of the AppCompatTextView?


Auto sizing doesn't play well with
wrap_content, probably because it needs to know its size before it can say how big its content will be. Do you have any of that going on anywhere in the hierarchy, like in the layout yourAppCompatTextViewsare in?Right now your widths depend on how wide
parentis, but if that'swrap_content(or its parent is, etc etc) then eventually that text view is gonna get asked how wide it wants to be, and it gets confused