I am new in android , recently I have learned recyclerview
and i want to change the color of rows.
Example: I have 10 rows and I want to change color like
You can change the color of alternate row by adding the following code on your Adapter class. You can also change the images of your row by using this code.
Put this code inside OnBindViewHolder
in Adapter Class.
if(position %2 == 1)
{
holder.itemView.setBackgroundColor(Color.parseColor("#FFFFFF"));
// holder.imageView.setBackgroundColor(Color.parseColor("#FFFFFF"));
}
else
{
holder.itemView.setBackgroundColor(Color.parseColor("#FFFAF8FD"));
// holder.imageView.setBackgroundColor(Color.parseColor("#FFFAF8FD"));
}