简体   繁体   English

Android-所选项目在列表视图中的位置

[英]Android - selected item position in a listview

How can I retrieve the positions of the selected item in a multichoice listView? 如何在多选listView中检索所选项目的位置? The getSelectedItemPosition method returns only the first one. getSelectedItemPosition方法仅返回第一个。

There is at most one selected item in a ListView . ListView中最多有一个选定的项目。

If your ListView is CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE , you can use getCheckedItemPositions() to get the checked ones. 如果您的ListViewCHOICE_MODE_SINGLECHOICE_MODE_MULTIPLE ,则可以使用CHOICE_MODE_MULTIPLE getCheckedItemPositions()来获取选中的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM