Если вы не хотите, чтобы текст был кликабельным, вы можете заменить один тег <CheckBox>
на <LinearLayout>
, содержащий <CheckBox>
и <TextView>
.Например, это:
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="hello world"/>
можно заменить на это:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="hello world"/>
</LinearLayout>
Если вы хотите нарисовать прямоугольник вокруг флажка, чтобы он выделялся еще больше, вы можете обернутьэто в <FrameLayout>
с цветным фоном:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fac">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="hello world"/>
</LinearLayout>