Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This syntax seems to work for me, when trying to use attributes:</p> <pre><code>&lt;TextView android:layout_width="match_parent" android:layout_height="match_parent" android:textColor="?android:textColorPrimary" android:text="Hello"/&gt; </code></pre> <p>(or)</p> <pre><code>&lt;style name="MyStyle"&gt; &lt;item name="android:textColor"&gt;?android:textColorPrimary&lt;/item&gt; &lt;/style&gt; </code></pre> <p>I can change the app theme from Holo to Holo.Light and the text color will change automatically to fit.</p> <p>It doesn't work when I set it as a background of a View though - Android will crash complaining that the drawable referenced is a state list that does not specify drawables (it is a <a href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/color/primary_text_holo_dark.xml">state list of colors</a>).</p> <pre><code> Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: &lt;item&gt; tag requires a 'drawable' attribute or child tag defining a drawable at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:178) at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) at android.content.res.Resources.loadDrawable(Resources.java:1950) ... 39 more </code></pre> <p>I am using <a href="https://github.com/Prototik/HoloEverywhere">HoloEverywhere</a> which lets me reference the resources directly, but you should get a similar problem in the native case. I don't think the primary, non-selected, non-activated (etc.) color used as a component in the state list xml is exposed through an attribute.</p> <p>In any case, the text color used is dependent on the theme that you, the app developer, chooses. If you choose to use the Holo (dark) theme then your text will be a light color, and the user won't be able to affect this. You don't need to make the your line color dynamic for your app.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload