tags:

views:

42

answers:

1

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"
> />
+1  A: 

(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"
> />
gregm