I can't find any documentation or something like that about "?" "@" ":" symbol in android xml. It often using in themes and styles in android development. What is symbols exactly means can't understand.
Please give some docs?
I can't find any documentation or something like that about "?" "@" ":" symbol in android xml. It often using in themes and styles in android development. What is symbols exactly means can't understand.
Please give some docs?
Share Improve this question edited Mar 10 at 15:05 TylerH 21.1k79 gold badges79 silver badges114 bronze badges asked Mar 10 at 7:34 AbbosAbbos 1 1- 1 Documentation – tomerpacific Commented Mar 10 at 7:49
2 Answers
Reset to default 1These are pretty simple actually.
1. The "@" is the symbol which is used for resources or while declaring id, like @string/hello
, @+id/button
, or @drawable/my_drawable
.
2. The "?" is refers to a theme attribute or styleable content, like if you want to define any theme attribute in styles like color etc, you would use this. eg ?attr/colorPrimary
.
3.And the last ":" is commonly used in namespaces in XML, it is used to seperate the prefix in the namespace. for eg. android:layout_width="match_parent"
. Hence you would know that android is the prefix in the namespace declared.
Those links may help you,plz check.
https://developer.android/guide/topics/resources/providing-resources#ResourcesFromXml
https://developer.android/studio/write/vector-asset-studio#referring