Matthew Whittenham Matthew Whittenham - 1 year ago 86
Java Question

How to set TextView text colour in Android Studio API 10

I am creating an Android API 10 app, and am trying to set the colour of text in TextViews. I wish to set the colour to red, but 'holo_red_dark', which is the colour I am using is only available for API 14 & above. I cannot find any colour red in the 'resources' window that is compatible with API 10, so I just wanted to know how I would get around this? Thanks.

Answer Source

You can create a colors.xml file in your res folder and define your colors.


<?xml version="1.0" encoding="utf-8"?>
     <item name="blue" type="color">#FF33B5E5</item>

And use it like


Check this:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download