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


i have checkbox code in cardview layout file. cardview has white background. normally, think unchecked checkbox black square. layout shows no blank checkbox. see white cardview background (top cardview in screenshot). when click on right-most area of cardview checkbox code formatted, green checkbox appears (bottom cardview in screenshot). missing here? enter image description here.

layout file:

<linearlayout  xmlns:android="http://schemas.android.com/apk/res/android" 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://schemas.android.com/apk/res-auto"     xmlns:android="http://schemas.android.com/apk/res/android"     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>  adapter file: ... public class listviewholder extends recyclerview.viewholder {      textview cardblanktext2;     textview cardblanktext3;     checkbox chkselected;      public listviewholder(view itemview) {         super(itemview);          cardblanktext2 = (textview)itemview.findviewbyid(r.id.cardblanktext2);         cardblanktext3 = (textview)itemview.findviewbyid(r.id.cardblanktext3);         chkselected = (checkbox) itemview.findviewbyid(r.id.chkselected);     } ... @override public void onbindviewholder(final listviewholder holder, final int position) {          holder.cardblanktext2.settext(dblist.get(position).gettodo());         holder.cardblanktext3.settext(dblist.get(position).getnote1());         holder.chkselected.setchecked(dblist.get(position).isselected());         holder.chkselected.settag(dblist.get(position)); } 

possible reasons:

  • your checkbox in white color.

  • it's visibility may gone

also add toleftof attribute textview's may not overlap checkbox.check theme color of checkbox.if not can put drawable ?android:attr/listchoiceindicatormultiple unchecked state


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -