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 ?
有时我在xml节点的内容中看到问号,我不知道它是什么,没有文档对吗?
1 个解决方案
#1
3
The ?
references a resource in the current theme, it's decribed in Developer's Guide Accessing Resources:
的?引用当前主题中的资源,它在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."
样式属性资源允许您在当前应用的主题中引用属性的值。引用样式属性允许您通过设置UI元素的样式来自定义UI元素的外观,以匹配当前主题提供的标准变体,而不是提供硬编码值。引用样式属性实质上是说,“在当前主题中使用由此属性定义的样式。”
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:
要引用样式属性,名称语法几乎与普通资源格式相同,但使用问号(?)代替at符号(?),资源类型部分是可选的。例如:
?[<package_name>:][<resource_type>/]<resource_name>
#1
3
The ?
references a resource in the current theme, it's decribed in Developer's Guide Accessing Resources:
的?引用当前主题中的资源,它在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."
样式属性资源允许您在当前应用的主题中引用属性的值。引用样式属性允许您通过设置UI元素的样式来自定义UI元素的外观,以匹配当前主题提供的标准变体,而不是提供硬编码值。引用样式属性实质上是说,“在当前主题中使用由此属性定义的样式。”
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:
要引用样式属性,名称语法几乎与普通资源格式相同,但使用问号(?)代替at符号(?),资源类型部分是可选的。例如:
?[<package_name>:][<resource_type>/]<resource_name>