Answer the question
In order to leave comments, you need to log in
How to change colors depending on the theme?
Such a situation, in the program, you can choose a theme for the program (roughly speaking holo light (by default) or holo dark), and, as I understand it, the colors specified in colors.xml cannot change depending on the selected theme. In the drawable, let's say the background color of the element is described, how to change it if holo dark is selected?
Answer the question
In order to leave comments, you need to log in
create links in attr.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="titleColor" format="reference|color" />
<attr name="introColor" format="reference|color" />
</resources>
<style name="AppTheme.MyDark" parent="android:Theme">
<item name="titleColor">#FFFFFF</item>
<item name="introColor">#FFFFFF</item>
</style>
<style name="AppTheme.MyLight" parent="android:Theme">
<item name="titleColor">#000000</item>
<item name="introColor">#004444</item>
</style
TextView
android:id="@+id/quoteTitle"
android:textColor="?titleColor"
...
</TextView>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question