我正在使用带有节和标题的luizgrp sectionedrecyclerviewadapter节, 并在项目选择上我更改文本颜色然后更改notifyData但它只反映在一个部分,每个部分都有一个选定的项目着色,我如何通知整个列表?
@Override
public void onBindItemViewHolder(RecyclerView.ViewHolder holder, final int position) {
final ItemViewHolder itemHolder = (ItemViewHolder) holder;
if(position == selectedPosition) {
itemHolder.txtTime.setTextColor(Color.parseColor("#00aaff"));
itemHolder.txtType.setTextColor(Color.parseColor("#00aaff"));
} else {
itemHolder.txtTime.setTextColor(Color.parseColor("#000000"));
itemHolder.txtType.setTextColor(Color.parseColor("#000000"));
}
itemHolder.rootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectedPosition=position;
recyclerView.getAdapter().notifyDataSetChanged();
}
});
}
}