<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:lines="1"
android:maxLines="1"
app:autoSizeMinTextSize="20sp"
app:autoSizeMaxTextSize="28sp"
app:autoSizeTextType="uniform"
app:layout_constrainedWidth="true" />
Let's say the text size of the TextView
is set to minimum (20sp) after resizing and setting the text to for example XXXXXXXXXXXXXXXXXXXXXX.
Then, I would like to set a new text which is XXX where I expect that the TextView
restores it's MaxTextSize. However, the behavior is not as expected and the text size stays the same (minimum (20sp)) since the TextView
cannot determine its auto size width because of wrap_content
.
Is it possible to invalidate or reset the TextView
to it's initial state for it to determine what text size should be applied?
Note: It is required that the TextView
should have wrap_content
as its width and I am aware that the documentation states that wrap_content
and auto-resizing sometimes results into an unexpected behavior.