Trying to set a color which is defined in res/values/colors.xml to an 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 it is not working,
I tried a lot of approaches (getResources(), Color.parseColor(), ...)
How do I set the color "tableHead" e.g. to a TextView?
tv.setBackgroundColor(????);
In XML, we can set a text color by the textColor attribute, like android:textColor="#FF0000" .
screen); View root = someView. getRootView(); root. setBackgroundColor(color. white);
Color entries should be like this
<color name="tableHead">#FF444444</color>
and use tv.setBackgroundResource(R.color.tableHead);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With