I am new in android , recently I have learned recyclerview and i want to change the color of rows.
recyclerview
Example: I have 10 rows and I want to change color like
Using Kotlin
if (position % 2 == 1) { holder?.itemView?.setBackgroundColor(context.resources.getColor(R.color.text_gray)) } else { holder?.itemView?.setBackgroundColor(context.resources.getColor(R.color.white)) }