Android 我的复选框未出现在我的CheckedTextView中
下面是我如何设置选中文本视图的。为什么没有出现复选框 我还添加了以下内容,但没有效果: listView.setChoiceMode(listView.CHOICE\u MODE\u SINGLE)Android 我的复选框未出现在我的CheckedTextView中,android,Android,下面是我如何设置选中文本视图的。为什么没有出现复选框 我还添加了以下内容,但没有效果: listView.setChoiceMode(listView.CHOICE\u MODE\u SINGLE) (我在回答我自己的问题,因为它在Android API中没有记录) 这还不够: listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); 您需要包括android:checkMark=“?android:attr/ListChoiceIndicat
(我在回答我自己的问题,因为它在Android API中没有记录)
这还不够:
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
您需要包括android:checkMark=“?android:attr/ListChoiceIndicator多个”
否则
您可以在drawable文件夹中拥有自己的checkbox.xml
然后您可以将其编写为android:checkMark=“@drawable/checkbox”CheckedEditText文档定义了。对于本例:
checkedEditText.setCheckMarkDrawable(android.R.attr.listChoiceIndicatorMultiple)代码>
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"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
/>