Android API之CheckedTextView代码演示

2014-11-24 09:04:42 ? 作者: ? 浏览: 0

类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 资源


TextView多选框


CheckedTextView


TextView多选框1


TextView多选框2


TextView多选框3


TextView多选框4


-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: