Android Recyclerview

80 Views Asked by At

Can anyone tell me how to implement different colors for individual items of recyclerview? Actually, my recyclerview items are video items and they are assigned types also (classical, pop, etc), and I want to assign colors according to the type.

How do I implement that?

1

There are 1 best solutions below

1
On

Normally, you set up all the views for a RecyclerView item in onBindViewHolder() function of the adapter. So, have a LinearLayout (or other layout) for your item, find the layout in the onBindViewHolder() and use setBackgroundColor() on it.