How to apply background color to listview dynamically in Android?
How to apply background color to listview dynamically in Androi开发者_开发问答d?
I'm not sure what it is you want to do but one of View.setBackgroundColor()
, View.setBackgroundDrawable()
or View.setBackgroundResource
should cover it, depending on what you want to show.
Remember, each item in a ListView
is a View
in its own right, so depending on how you're creating them, they may be obscuring the background you're setting for your ListView
.
You may also need to disable the cache color hint to get your views to display how you want. Have a look at this post of the Android Developer's Blog for more information.
精彩评论