You can set the gravity of a Checkbox to left and center_vertical by adding the following attributes to the Checkbox in XML:

android:layout_gravity="left|center_vertical"

This will align the Checkbox to the left of its parent view and center it vertically.

Example:

<CheckBox
    android:id="@+id/my_checkbox"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="My Checkbox"
    android:layout_gravity="left|center_vertical" />
how to set to left and center_vertical of checkbox in android studio

原文地址: https://www.cveoy.top/t/topic/b4SK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录