开发者

I want to dynamic change dialog's list item's textcolor. But list.getChildAt() confused me very much! Can you help me?

开发者 https://www.devze.com 2023-02-25 06:44 出处:网络
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百科

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.

0

精彩评论

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