Java – The question mark is foreign to me

The question mark is foreign to me… here is a solution to the problem.

The question mark is foreign to me


style=”?android:attr/listSeparatorTextViewStyle” />

Or this

   <item name="android:textColor">?textColorSecondary</item>

Sometimes I see such a question mark in the content of the xml node, but I don’t know what it’s for, no documentation, right?


? References to resources in the current topic, described in the developer guide Accessing Resources :

A style attribute resource allows you to reference the value of an attribute in the currently-applied theme. Referencing a style attribute allows you to customize the look of UI elements by styling them to match standard variations supplied by the current theme, instead of supplying a hard-coded value. Referencing a style attribute essentially says, “use the style that is defined by this attribute, in the current theme.”

To reference a style attribute, the name syntax is almost identical to
the normal resource format, but instead of the at-symbol (@), use a question-mark (?), and the resource type portion is optional. For instance:

?[ <package_name>:][<resource_type>/]<resource_name>

Related Problems and Solutions