开发者

How to apply background color to listview dynamically in Android?

开发者 https://www.devze.com 2022-12-13 21:22 出处:网络
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.setBa

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消