I\'ve got in attrs.xml
<
You cannot reference ?attr/ when choosing colors for a selector. What you can do, if you want per-theme colors in your selector, is create multiple selectors which reference @color/ and @drawable/, and then have a "reference" attr which associates one of the selectors with the given style.
<attr name="forground_to_background" format="reference" />
You then have to set the text color like
android:textColor="?attr/forground_to_background"
I believe the text was always red because Android was interpreting the attr's integer value as a color (red), rather than using it as a lookup for what you actually wanted.
The reason why this happens is that I have different Context. While inflating Context is aware of my theme attrs, but to the ListView adapter I passed ApplicationContext that wasn't aware of those attrs. Now I don't know why it doesn't know about them ;)
Are you sure if you applying MyTheme to the activity or the textview? Another thing you can try is that instead of using the "?" operator in your forground_to_background.xml, trying using "@" instead. see if that fixes your problem