question
Now there is a requirement. In the Chinese environment, the textView does not exceed the underlying component limit, but it exceeds the limit when switching to the English environment. How to solve this? Are there any examples?
Just like this.
solve
The entire code is as follows:
<?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:id="@+id/cl_scene"
android:layout_width="match_parent"
android:layout_height="156dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:background="@mipmap/go_metachat_entrance"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/parent">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.49" />
<TextView
android:id="@+id/tv_title_scene"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/zego_metachat"
android:textColor="#ffffffff"
android:textSize="18dp"
app:layout_constraintLeft_toRightOf="@id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_pic"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="22dp"
android:src="@mipmap/app_legal_icon"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="@+id/tv_title_scene"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_desc_scene"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="7dp"
android:alpha="0.7"
android:layout_marginBottom="12dp"
android:text="@string/zego_metachat_des"
android:textColor="#ffffffff"
android:autoSizeStepGranularity="1sp"
android:autoSizeMaxTextSize="13sp"
android:autoSizeMinTextSize="8sp"
android:autoSizeTextType="uniform"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/tv_title_scene"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
Please pay special attention to the configuration of the last textView.
android:autoSizeStepGranularity=“1sp”.
android:autoSizeMaxTextSize=“13sp”
android:autoSizeMinTextSize=“8sp”
android:autoSizeTextType=“uniform”`