Skip to content Skip to sidebar Skip to footer

How To Change Background Of One Item From Listview In Code

I have inherited ListActivity and I need to change in code background color of some rows. How to do that, for example first row to set YELLOW background ? public class AlarmsActivi

Solution 1:

Take some array of colors and then in getView method set the view color to the pos. for example :

privateint[] colors=newint[]{0xfffff000, 0xffff0000, .....};

in getView() write this:

view.setBackgroundColor(colors[pos]);

here pos is the index value in the colors[]

Post a Comment for "How To Change Background Of One Item From Listview In Code"