我正在使用ListView来提供一个供用户选择的列表。带有复选框的ListView - 为什么复选框不显示?
下面是主要代码:
SimpleAdapter adapter = new SimpleAdapter(this,contacts, R.layout.list_contact,
from_contacts, to_contacts);
listview_selected_contact.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listview_selected_contact.setAdapter(adapter);
我不知道为什么该复选框不显示? 程序正常运行,只是没有可见的复选框。 任何人都可以帮忙吗?
这里是XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:textAppearance="?android:attr/textAppearanceMedium" android:id="@+id/username"></TextView>
</LinearLayout>
我认为这是因为您提供了自己的布局。告诉我们你的layout.xml –
是的,我上传它。 –