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
In the onBindViewHolder of your adapter simply get the poisition and check that whether it is even or odd. If it is even, set the background color of your layout to red else blue
@Override
public void onBindViewHolder(final ViewHolder viewHolder, int position) {
if(position%2 == 0){
viewHolder.containerLayout.setBackgroundColor(R.color.RED);
} else {
viewHolder.containerLayout.setBackgroundColor(R.color.BLUE);
}}