简体   繁体   中英

Android:How can i change the color of the text of the ListAdapter?

The default color of the text is white. Let's say if i want to change the color, then how can i do it? Any clue?

in the getView method, find your TextView and set the color via setTextColor(). If you want your color changed for you based on the state of the item ( selected/focused etc) create new color in my_color.xml and define your states - examples of stateful colors are in SDK in res folders.

One thing you could do is use your own layout for the list items. This way you could set whatever color or any other layout in the items.

You couldn't use setTextColor(); in your ListAdapter ? I think you could

I highly recommened writing your own theme for the list view and then setting it in the layouts xml file, this means that you can use the same style throughout your app

This is a good tutorial to start with http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM