Kotlin - 设置复选框下方的文本

Kotlin - set the text below the Checkbox

我找不到这个简单的任务:有没有办法更改与复选框关联的文本的位置?

在下面的示例中,我希望将字符串“test”设置在复选框下方而不是右侧。感谢您帮助新手。

<CheckBox
                android:id="@+id/checkBox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:buttonTint="@color/white"
                android:text="test"
                android:textColor="@color/white"/>

也许这对您有帮助!

<androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <CheckBox
                android:id="@+id/checkBox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                app:layout_constraintBottom_toTopOf="@+id/test"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                tools:ignore="MissingConstraints" />

            <TextView
                android:id="@+id/test"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="Checkbox"
                android:textAlignment="center"
                android:textColor="@color/black"
                android:textSize="24sp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/checkBox" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>