Android: id = & quot; @ + id/my_button & quo in the android xml file

Source: Internet
Author: User
Tags xml parser

Many UI developers have questions about the meaning of android: id = "@ + id/my_button". The students carefully found that the official SDK is explained in this way,
Certificate -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
The at-symbol (@) at the beginning of the string indicates that the XML parser shoshould parse and expand the rest of the ID string and identify it as an ID resource. the plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R. java file ). there are a number of other ID resources that are offered by the Android framework. when referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace, like so:

Android: id = "@ android: id/empty"
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------------------------------

That is to say, the @ symbol should notify the xml to convert the string behind @ to the ID resource, and the + sign indicates that this is to create a new resource name and add it to the R. java file.
When you want to reference an existing resource, you can directly write it as @ android: id/empty

 

From: column of Octobershiner

Related Article

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.