1对应集合实体类增加是否点击的属性

public static class ChildrenListDTO {
private boolean isClick = false;

public boolean isClick() {
return isClick;
}

public void setClick(boolean click) {
isClick = click;
}

2点击的时候改变标志位状态,此时唤醒适配器;注意 recyClassAdapter1.notifyDataSetChanged();

childrenListThree.get(tag).setClick(true);
recyClassAdapter1.notifyDataSetChanged();

3适配中添加控件颜色改变的判断;注意 holder.tv.setTextColor(context.getColor(R.color.blue));

public void onBindViewHolder(ViewHolder holder, int position) {
// int newPos=position%datas.size();


holder.tv.setText(datas.get(position).getClassificationName());
Log.e("wy", "73 onBindViewHolder : " + datas.get(position).isClick());
if (datas.get(position).isClick()) {
datas.get(position).setClick(false);
holder.tv.setTextColor(context.getColor(R.color.blue));
} else {
holder.tv.setTextColor(context.getColor(R.color.black));
}

RV点击条目改变字体颜色(数据驱动UI)_改rv条目颜色