I've had weird experience when i scroll the RecyclerView. There is a item_layout for the RecyclerView's item. The item layout xml consists of 3 Textview and 1 ConstraintLayout. the rootview is ConstriantLayout.
All the TextView's layout_height is wrap_content and layout_width is 0dp(match_constraint) but basically TextView autosize doesn't work correctly when the view's layout_height is wrap_content. so everytime i scroll the RecyclerView, the TextView3's characters become smaller and then get back to the maxSize. so i changed the layout_height of TextView3 into 0dp(match_constrarint). it worked fine. but the reason why i ask is TextView1 and TextView2 works fine even though they still have wrap_content. how does it work???
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="1"
android:textSize="@dimen/detail_txt_title"
app:autoSizeMaxTextSize="@dimen/detail_txt_title"
app:autoSizeMinTextSize="@dimen/detail_txt_summary"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toTopOf="@id/TextView2"
app:layout_constraintRight_toLeftOf="@id/TextView3"
app:layout_constraintHorizontal_weight="2.1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/black"
android:textSize="@dimen/detail_txt_title_small"
app:autoSizeMaxTextSize="@dimen/detail_txt_title_small"
app:autoSizeMinTextSize="@dimen/detail_txt_summary"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="@id/textView1"
app:layout_constraintLeft_toLeftOf="@id/textView1"
app:layout_constraintTop_toBottomOf="@id/textView1" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/textview3"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/daily_history_text_black"
android:textSize="@dimen/detail_txt_title"
app:autoSizeMaxTextSize="@dimen/detail_txt_title"
app:autoSizeMinTextSize="@dimen/detail_txt_summary"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_weight="2.1"
app:layout_constraintLeft_toRightOf="@id/textview1"
app:layout_constraintTop_toTopOf="parent" />
See this: Autosize textview is not working It seems to be normal for
autoSize
text to produce inconsistent results when used withwrap_content
the fact that it is working is just one of those inconsistences.