Android新的API中已弃用getCheckItemIds(),而使用getCheckedItemIds(),来获取ListView 被选中的Item.
说说使用方法吧
1.使用方式跟以前的一样 long[] pos = mListView.getCheckedItemIds();2.pos值
就是ListView选中的position collection3.注意点
Adapter中需要重写hasStableIds( )方法,return true
@Override
public boolean hasStableIds() {
return true;
}
本文介绍Android中ListView获取选中项的新API getCheckedItemIds() 的使用方法及注意事项。该API替代了已弃用的getCheckItemIds(),需在Adapter中重写hasStableIds()并返回true。
1327

被折叠的 条评论
为什么被折叠?



