【发布时间】:2015-07-30 14:47:34
【问题描述】:
我尝试创建一个多项选择列表视图,但我只能选择一个。这是我的代码:
选择器(multiselect_background.xml):
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/blue" android:state_checked="true"/>
<item android:drawable="@color/red" android:state_pressed="true"/>
<item android:drawable="@color/grey"/>
</selector>
列表视图(list.xml):
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="multipleChoice"
/>
布局(select_item.xml):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/multiselect_background">
有人知道,为什么不能进行多选?非常感谢!!
【问题讨论】:
标签: android listview android-listview