类CheckedTextView继承超类TextView并实现Checkable接口。当ListView的setChoiceMode方法并设定为CHOICE_MODE_SINGLE或者CHOICE_MODE_MULTIPLE,而非CHOICE_MODE_NONE时,使用此类是很有用的。
使用范例:
(1)
/res/layout/main.xml 中添加相应资源ID
android:layout_width="fill_parent" android:layout_height="wrap_content" /> android:id="@+id/checkedTextView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:checkMark=" android:attr/listChoiceIndicatorMultiple" android:text="@string/checkedTextView1" /> android:id="@+id/checkedTextView2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:checkMark=" android:attr/listChoiceIndicatorMultiple" android:text="@string/checkedTextView2" /> android:id="@+id/checkedTextView3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:checkMark=" android:attr/listChoiceIndicatorMultiple" android:text="@string/checkedTextView3" /> android:id="@+id/checkedTextView4" android:layout_width="fill_parent" android:layout_height="wrap_content" android:checkMark=" android:attr/listChoiceIndicatorMultiple" android:text="@string/checkedTextView4" /> (2)/res/values/strings.xml 资源