// 如果已经勾选,单击置为非勾选状态,
if (dataBean.isChoose()) {
dataBean.setChoose(false);
adapter.getChooseList().remove(dataBean);
} else { // 如果未勾选,单击置为勾选状态,
dataBean.setChoose(true);
adapter.getChooseList().add(dataBean);
}
adapter.notifyDataSetChanged();
// 如果已经勾选,单击置为非勾选状态,
if (dataBean.isChoose()) {
dataBean.setChoose(false);
for (int i = 0; i <adapter.getChooseList().size() ; i++) {
if (adapter.getChooseList().get(i).getM_id().equals(StringUtils.notNull(dataBean.getM_id()))){
adapter.getChooseList().remove(i);
}
}
} else { // 如果未勾选,单击置为勾选状态,
dataBean.setChoose(true);
adapter.getChooseList().add(dataBean);
}
adapter.notifyDataSetChanged();
注意:
** 不同的实例不能移除**