什么是它们之间的区别?
android:color="@android:color/black"
并且
style="?android:attr/borderlessButtonStyle"
“@”和“?”有什么区别?
这是一个无法通过搜索引擎解答的问题,或者需要使用ogooglebar。
什么是它们之间的区别?
android:color="@android:color/black"
并且
style="?android:attr/borderlessButtonStyle"
“@”和“?”有什么区别?
这是一个无法通过搜索引擎解答的问题,或者需要使用ogooglebar。
@android:color/black
这表示你正在引用 Android 命名空间中定义的一个颜色。此命名空间是框架的命名空间。
在此文件中搜索黑色:框架中的黑色颜色
style="?android:attr/borderlessButtonStyle"
"?android:attr/borderlessButtonStyle" 简单地意味着“使用 android 命名空间中名为 borderlessButtonStyle 的属性所定义的值”。此属性及其值是 Android 框架的一部分,即“android”命名空间。
编辑:来自于引用样式属性
该链接告诉我们:
例如,以下是如何引用属性以将文本颜色设置为匹配系统主题“primary”文本颜色的方式:
<EditText id="text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="?android:textColorSecondary"
android:text="@string/hello_world" />
(@)
,而是使用问号(?)
,并且资源类型部分是可选的。 - devnull