I have tried this and also holder.setIsRecyclable(false);
But i am unable to maintain the background of view
this is my view after selecting
and when I scroll it loses the view,
any guidance will be great
EDIT : CODE
holder.setIsRecyclable(false);
final GradientDrawable gd2=new GradientDrawable();
gd2.setShape(GradientDrawable.OVAL);
gd2.setSize(24,24);
gd2.setStroke(2, Color.parseColor("#5FB382"));
final GradientDrawable gd = new GradientDrawable();
gd.setShape(GradientDrawable.OVAL);
gd.setStroke(2, Color.parseColor("#FBAA35"));
gd.setSize(24,24);
holder.favorite.setTextColor(Color.parseColor("#FBAA35"));
holder.hatIcon.setTextColor(Color.parseColor("#5FB382"));
holder.hatIcon.getCurrentTextColor();
holder.hatIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (holder.hatIcon.getCurrentTextColor() == Color.parseColor("#5FB382")) {
holder.hatIcon.setTextColor(Color.parseColor("#ffffff"));
holder.hatIcon.setBackgroundColor(Color.parseColor("#5FB382"));
gd2.setColor(Color.parseColor("#5FB382"));
}
else {
Debug.e();
holder.hatIcon.setTextColor(Color.parseColor("#5FB382"));
gd2.setColor(Color.parseColor("#ffffff"));
}
}
});