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" />
(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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With