I want to dynamic change dialog's list item's textcolor. But list.getChildAt() confused me very much! Can you help me?
I got that it seems the list.getchildAt() method return not null only when the list has shown once. If the list has not shown before, I call List.getChildAt() will return null. How ca开发者_Python百科n I do it, I want before the dialog's list shown before to change the list item's textcolor?
If your background is not data-sensible, you can style your list applying a custom theme to it: set the items' background, selector, etc.
If you need your list items to have different background based on the data they display, you should create your own ListView
, and put it inside a Dialog
.
In your ListView
implementation you override the ListAdapter
's getView
method, and set the proper background for the current item.
精彩评论