java - Android: set color programatically from XML color constants -


trying set color defined in res/values/colors.xml object,

<?xml version="1.0" encoding="utf-8"?> <resources>   <drawable name="listviewselected">@android:color/holo_blue_light</drawable>   <drawable name="listviewpressed">@android:color/holo_green_light</drawable>   <drawable name="pagertabstrip">#2b3333</drawable>   <!--<drawable name="pagertabstrip">#353f3e</drawable>-->   <drawable name="tablehead">#ff444444</drawable>  </resources> 

i can not figure out why not working, tried lot of approaches (getresources(), color.parsecolor(), ...)

how set color "tablehead" e.g. textview?

tv.setbackgroundcolor(????);

color entries should this

<color name="tablehead">#ff444444</color>

and use tv.setbackgroundresource(r.color.tablehead);


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -