Reputation: 43
This
<TextView
xmlns:android=”http://schemas.android.com/apk/res/android”
android:id=”@+id/separator”
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:gravity=”center”
style=”?android:attr/listSeparatorTextViewStyle” />
or this
<item name="android:textColor">?textColorSecondary</item>
Sometimes I see the question mark in the xml node's content like that, and I don't know what it is for, no documentation right ?
Upvotes: 4
Views: 231
Reputation: 1747
The ?
references a resource in the current theme, it's decribed in Developer's 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>
Upvotes: 3