Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

My checkbox does not appear in my CheckedTextView

Tags:

Here is how I setup my checked text view. How come no check box appeared?

I also added this but it had not effect: listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

 <CheckedTextView  android:id="@+id/ctv_checktext"  android:layout_width="fill_parent"  android:paddingLeft="2px"  android:paddingRight="2px"  android:paddingTop="2px"  android:layout_height="wrap_content"  /> 
like image 987
gregm Avatar asked May 28 '10 11:05

gregm


1 Answers

(I'm answering my own question because it's undocumented in the Android API)

This is not enough:

listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); 

You need to include the android:checkMark="?android:attr/listChoiceIndicatorMultiple" or else

 <CheckedTextView  android:id="@+id/ctv_checktext"  android:layout_width="fill_parent"  android:paddingLeft="2px"  android:paddingRight="2px"  android:paddingTop="2px"  android:layout_height="wrap_content"  android:checkMark="?android:attr/listChoiceIndicatorMultiple"  /> 
like image 104
gregm Avatar answered Oct 04 '22 10:10

gregm