I'm creating an application which uses Android 4.0. I'm wondering if it is possible to change the text color of the text in a switch.
I've tried setting the text color, but it doesn't work.
Thanks in advance!
You must use
and in styles:
you can also do it in code, also using above styles:
...and as for
you can check it in
TextView.setTextColor() takes an int representing the color (eg. 0xFFF5DC49) not the resource id from the xml file. In an activity, you can do something like:
outside of an activity you'll need a Context eg.
For more refer this
I think you have to look at the theme which you are using for your application. Because the color of the switch is the responsibility of the theme, afaik. So I would suggest you have a look on how you can change the settings of a theme. Or you could create a custom theme with the new colors.