qxCb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean isCheck = qxCb.isChecked(); if (isCheck) { selectedPositions.clear(); for (int i = 0; i < sourceList.size(); i++) { selectedPositions.add(i + ""); } adapter.notifyDataSetChanged(); } else { selectedPositions.clear(); adapter.notifyDataSetChanged(); } } }); final CheckBox checkBox = holder.getView(R.id.selectCb); if (selectedPositions.contains(layoutPosition + "")) { checkBox.setChecked(true); } else { checkBox.setChecked(false); } checkBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean isChecked = checkBox.isChecked(); if (isChecked) { checkBox.setClickable(false); checkBox.setEnabled(false); if (!selectedPositions.contains(layoutPosition + "")) { selectedPositions.add(layoutPosition + ""); checkBox.setClickable(true); checkBox.setEnabled(true); } else { checkBox.setClickable(true); checkBox.setEnabled(true); } } else { checkBox.setClickable(false); checkBox.setEnabled(false); //全选失效 if (qxCb.isChecked()) { qxCb.setChecked(false); } if (selectedPositions != null && selectedPositions.contains(layoutPosition + "")) { selectedPositions.remove(layoutPosition + ""); checkBox.setClickable(true); checkBox.setEnabled(true); } else { checkBox.setClickable(true); checkBox.setEnabled(true); } } } });