почему текст чекбокса не появляется через android: текст, есть ли причина? - PullRequest
0 голосов
/ 06 мая 2019

Текст флажка не отображается через android: text. Пробовал при изменении цвета текста, но результат тот же.почему это происходит?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/ll_parent_adapter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<android.support.v7.widget.CardView
    android:id="@+id/resudlt_cv"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="4dp"
    android:layout_marginRight="4dp"
    android:layout_marginTop="4dp"
    app:cardElevation="20dp"
    app:cardPreventCornerOverlap="true">

  <LinearLayout
    android:visibility="gone"
    android:id="@+id/llCheckBox"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:orientation="horizontal">

    <CheckBox
        android:id="@+id/checkBoxMarkAsComplete"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:text="Mark as complete"
        android:textColor="@color/colorBlack"
        android:buttonTint="@color/colorVendorCheckBox"/>

</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>

полный XML приведен выше согласно запросу.

Ответы [ 2 ]

0 голосов
/ 06 мая 2019

Вы установили layout_width, чтобы зафиксировать значение 30dp. Попробуйте установить ширину флажка wrap_content.

0 голосов
/ 06 мая 2019

Попробуйте это:

<CheckBox
        android:id="@+id/checkBoxMarkAsComplete"
        android:layout_width="wrap_content" \\ change this line
        android:layout_height="30dp"
        tools:text="try this"
        android:textColor="@color/colorBlack"
        android:buttonTint="@color/colorVendorCheckBox"
        android:text="@string/Mark_as_complete" />

и добавьте это к корневому представлению:

 xmlns:tools="http://schemas.android.com/tools"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...