如何均衡textView中的文本

how to equalize text within textView

如何自动均衡text&textView?我正在使用 Android Studio

image of the question

<TextView
    android:id="@+id/textView"
    android:layout_width="362dp"
    android:layout_height="283dp"
    android:layout_marginTop="20dp"
    android:background="#9422C5"
    android:backgroundTint="#34C3A4FD"
    android:text="this is the place where I want to equalize the textView according to text"
    android:textColor="#000000"
    android:textSize="18sp"
    android:visibility="visible"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.489"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

宽度和高度使用 wrap_content。

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp"
    android:background="#9422C5"
    android:backgroundTint="#34C3A4FD"
    android:text="this is the place where I want to equalize the textView according to text"
    android:textColor="#000000"
    android:textSize="18sp"
    android:visibility="visible"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.489"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

您可以只为宽度和高度属性设置“wrap_content”。如有必要,添加一些填充

    <TextView
        android:padding="10dp"
        android:id="@+id/my_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />