@, @ Android: type, @ *, and ,@*,? , @ + Meaning and Difference
I. @ indicates referencing Resources
1. Reference custom resources. Format: @ [Package:] type/Name
Android: text = "@ string/hello"
2. reference system resources. Format: @ Android: type/Name
Android: textcolor = "@ Android: color/opaque_red"
Note: In fact@ Android: type/name is a subclass of @ [Package:] type/Name
2. @ * indicates that the system's non-public resources are referenced. Format: @ * Android: type/Name
System resource definition is divided into public and non-public. The public statement is as follows:
<Sdk_path> \ platforms \ Android-8 \ data \ res \ values \ public. xml
@ * Android: type/Name:All resources defined by the system can be called.
@ Android: type/Name:Only resources with the publi attribute can be called.
Note: resources not declared in public. XML are not recommended by Google.
3 .? Reference topic attributes
Another resource value allows you to reference the attribute values in the current topic. This attribute value can only be used in style resources and XML attributes. It allows you to change the appearance of the UI element by changing them to the standard changes provided by the current topic, rather than providing specific values. For example:
Android: textcolor = "? Android: textdisabledcolor"
Note that this is very similar to resource reference, except that we use "? "Prefix replaces "@". When you use this tag, you provide the name of the property resource, which will be searched in the topic, so you do not need to display the Declaration type (if the Declaration, the form is? Android: ATTR/Android: textdisabledcolor ). Besides using the resource identifier to query the value in the topic instead of the original resource, the naming syntax is the same as that in the "@" Format :? [Namespace:] type/name. The type is optional.
Thu. @ + Indicates creating or referencing a resource. Format: @ + type/Name
Meaning: "+" indicates adding a record to the internal class named type in R. java. For example, "@ + ID/button" means to add a constant named "button" to the static internal class "ID" in the R. Java file. The constant is the identifier of the resource. If the identifier (including system resources) already exists, the identifier is referenced. The most common method is to define the resource ID, for example:
@ + ID/resource ID name create a resource ID
@ ID/resource ID name the application's existing defined resource ID, including the System ID
@ Android: ID/resource ID refers to the System ID, which is equivalent to @ ID/resource ID
Android: Id = "@ + ID/selectdlg"
Android: Id = "@ Android: ID/text1"
Android: Id = "@ ID/button3"