Android XML resource File @, @android: Type, @*,? , @+ meaning and difference

Source: Internet
Author: User

An [email protected] represents a reference resource

1. Reference a custom resource. Format: @[package:]type/name

android:text= "@string/hello"

2. Refer to 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

Two [email protected]* represents a non-public resource referencing the system. Format: @*android:type/name

System Resource definitions are divided between public and non-public. The declaration of public is in:

<sdk_path>\platforms\android-8\data\res\values\public.xml

@*android:type/name: can invoke all system-defined resources

@android: type/name: A resource that can only invoke the Publi property.

Note: Resources that are not declared in Public.xml are not recommended by Google.

Three.? Delegate reference topic Properties

Another resource value allows you to reference the value of a property in the current theme. This property value can only be used in style resources and XML attributes, and it allows you to change the appearance of UI elements 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 references, except that we use a "?" Prefix instead of "@". When you use this tag, you provide the name of the property resource, which will be looked up in the subject, so you do not need to display the declaration of that type (if the declaration is in the form of Android:attr/android:textdisabledcolor). In addition to using the identifier of this resource to query the values in the topic instead of the original resource, its naming syntax is the same as "@":? [Namespace:]type/name, this type is optional.]

Four [email protected]+ represents a resource in the creation or reference. Format: @+type/name

Meaning: "+" means that a record is added to the inner class named type in R.java. As the meaning of "@+id/button" is in the ID of the R.java file, this static inner class adds a constant named button. The constant is the identifier for the resource. If the identifier (including system resources) already exists, it indicates that the identifier is referenced. The most common use is in defining the resource ID, for example:

@+id/Resource ID name Create a new resource ID

@id/resource ID name to apply an existing defined resource ID, including the system ID

@android: ID/Resource IDs reference the system ID, which is equivalent to the @id/resource ID name

Android:id= "@+id/selectdlg"

Android:id= "@android: Id/text1"

Android:id= "@id/button3"
Url:http://greatverve.cnblogs.com/archive/2011/12/27/android-xml.html

Android XML resource File @, @android: Type, @*,? , @+ meaning and difference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.