lundi 18 avril 2016

Android: why does Checkbox not show empty checkbox for unchecked state?

I have checkbox code in a CardView layout file. The CardView has a white background. Normally, I think the unchecked Checkbox is a black square. My layout shows no blank checkbox. All I see is just the white CardView background (top CardView in the screenshot). When I click on the right-most area of the CardView where the checkbox code is formatted, a green Checkbox appears (bottom CardView in the screenshot). What am I missing here? enter image description here.

layout file:

<LinearLayout

xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/background4main"  >

<android.support.v7.widget.CardView
    xmlns:card_view="http://ift.tt/GEGVYd"
    xmlns:android="http://ift.tt/nIICcg"
    android:id="@+id/singlecard_view1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    card_view:cardBackgroundColor="@android:color/white"
    card_view:cardCornerRadius="6dp"
    android:orientation="horizontal"
    android:layout_margin="4dp">

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?android:selectableItemBackground"  >

    <TextView
        android:id="@+id/cardBlankText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:text="todo"
        android:textStyle="bold"
        android:textColor="@android:color/black"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="20sp"  />

    <TextView
        android:id="@+id/cardBlankText3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/cardBlankText2"
        android:text="note1"
        android:textStyle="bold"
        android:textColor="@android:color/black"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="20sp"  />

    <CheckBox
        android:id="@+id/chkSelected"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_centerVertical="true"  />

    </RelativeLayout>

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

</LinearLayout>




Aucun commentaire:

Enregistrer un commentaire