I have a ListView that I\'m populating from a custom ListAdapter. Inside the Adapter (in the getView(int, View, ViewGroup) method) I\'m setting the background color of the V
I ran into a similar problem where the divider was coming up grey. I found that the other solutions had no effect, but android:divider="<drawable,color, or whatever>"
on my ListView
worked.
You cold always wrap the whole row inside another view and set the background color on that view. This view would be the first (and only) child of the row.
You must set the cacheColorHint attribute to the desired background color for your list. This is a required workaround to account for a drawing optimization Android performs on lists.
See here: link text
try this:
setBackgroundColor(0xFF5DB9FB);
You should use:
setBackgroundResource(R.color.myRow_red)
instead of setBackgroundColor()
. In your example background color is assigned with the ID instead of the actual color described in the resources.
Try to do like this:
av.setBackgroundColor(getResources().getColor(R.color.myRow_red));