I have a recycler view and inside the onClick(View view)
i'm changing the background color to almost transparent red view.setBackgroundColor(Color.argb(64, 183, 28, 28));
but something weird is happening which is when I scroll down I see the color has changed for items that have not been clicked yet, my guess is when the item is recycled it is retaining the color. I want to remove that color but removing it inside the constructor for the holder is not working so my question is how do I go about that?
EDIT: after the comment this is more detailed code
public class GridHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public TextView Name;
public ImageView Photo;
public GridHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
Name = (TextView) itemView.findViewById(R.id.name);
Photo = (ImageView) itemView.findViewById(R.id.photo);
itemView.setClickable(true);
}
@Override
public void onClick(View view) {
view.setBackgroundColor(Color.argb(64, 183, 28, 28));
}
}