【发布时间】:2014-05-07 16:40:22
【问题描述】:
我有一个ListView,其中包含带有复选框的项目,这些复选框的行为有时应类似于CHOICE_MODE_MULTIPLE,有时类似于CHOICE_MODE_SINGLE。 What I mean is for certain items in the list, when selected certain other items needs to be deselected whilst other can remain selected.
所以当项目 A 被选中时,我可以在我的数据中找到需要取消选中的项目 B 但是我如何让 UI 刷新以将其显示为我(我相信)找不到代表 B 的实际 View,而只是它的数据?
【问题讨论】:
-
我想通了,我可以使用
getChildAt和getFirstVisiblePosition找到我需要更新的实际View,方法是获取项目索引并减去getFirstVisiblePosition返回的值。
标签: android android-listview listviewitem