在继承BaseAdapter的adapter中写入
private boolean isShow = false;
public boolean isShow() {
return isShow;
}
public void setShow(boolean isShow) {
this.isShow = isShow;
}
在getView中写入
if (isShow) {
holder.cbCheckBox.setVisibility(View.VISIBLE);
} else {
holder.cbCheckBox.setVisibility(View.GONE);
}
在activity中的按钮事件里写入
boolean isShow = babyManage.isShow();
babyManage.setShow(!isShow);
babyManage.notifyDataSetChanged();
布局文件
<CheckBox
android:id="@+id/cbCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:visibility="gone"
android:layout_alignParentTop="true" />