思路:在实体类中增加是否选中的标志位加以控制,点击全选遍历整个集合
1实体类中

public boolean isCheck;

2适配器的getView中

viewHolder.cbShopCar.setChecked(data.get(position).isCheck);

3activity中点击触发

allSelectDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
for (int i = 0; i < records.size(); i++) {
records.get(i).isCheck = true;
}
lvFoot.setAdapter(new ShopCarLvAdapter(records, ShopCarActivity.this));
// mAdapter.notifyDataSetChanged();

}
});

列表(listview)实现CheckBox全选效果_ide
实现取消全选

allSelectDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (allSelectDelete.isChecked()) {
for (int i = 0; i < records.size(); i++) {
records.get(i).isCheck = true;
}
} else {
for (int i = 0; i < records.size(); i++) {
records.get(i).isCheck = false;
}
}

lvFoot.setAdapter(new ShopCarLvAdapter(records, ShopCarActivity.this));
// mAdapter.notifyDataSetChanged();

}
});