//父
mypresenthodler.prenter_cb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Gouwuchebean.DataBean dataBean = list.get(i); boolean prenterck = dataBean.isPrenterck(); prenterck =!prenterck; dataBean.setPrenterck(prenterck); List<Gouwuchebean.DataBean.mybean> childlist = GouWuCheAdapter.this.list.get(i).getList(); for (int j = 0; j < childlist.size(); j++) { childlist.get(j).setChildck(prenterck); } notifyDataSetChanged(); } });
//子
myChiledholder.child_ck.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { boolean childck = mybean.isChildck(); childck =! childck; mybean.setChildck(childck); boolean flag = true; List<Gouwuchebean.DataBean.mybean> list1 = GouWuCheAdapter.this.list.get(i).getList(); for (int j = 0; j < list1.size(); j++) { if(!list1.get(j).isChildck()){ flag = false; } } list.get(i).setPrenterck(flag); notifyDataSetChanged(); } });