The difference between @id and @+id in an Android XML file

Source: Internet
Author: User

Today, when writing an Android layout file in XML because of the use of the Lenovo function input, originally to give a control to add an ID (the correct wording should be @+ide= ""), the result is automatically associated with the @id= "". And then in the activity inside the declaration of the time is not associated with the previously defined ID. It took a while to find the definition ID wrong. Now record the difference between the two ways of writing.

  @+id is to add a new ID to a given space that does not previously exist in the program, so it is necessary to declare a variable of the same type in the activity when used in the activity, and then reference the variable in the XML to the variable declared in the activity.

  

@id is the ID of the reference system, in the relative SDK directory of the Ids.xml file, the general external not to call, is the component internal call when using

The difference between @id and @+id in an Android XML file

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.