Differences between @ + id and @ id in Android, and androidid @ id
The component in Android needs to be represented by an int value, which is the id attribute value in the component tag. The id attribute can only accept the value of the resource type, that is, the value that must begin with @, such as @ id/abc and @ + id/xyz.
If "+" is used after @, it indicates that after a layout file is modified and saved, the system will automatically generate the corresponding int type variable in the R. java file. The variable name is the value after "/". For example, @ + id/xyz will generate int xyz = value in the R. java file, where value is a hexadecimal number. If xyz already has a variable with the same name in R. java, the new variable is not generated, and the component uses the value of this existing variable.
That is to say, if the form of @ + id/name exists in R. java, the component uses the value of this variable as the identifier. If the variable does not exist, add a new variable and assign the corresponding value to the variable (no duplicates ).
Since the id attribute of a component is a resource id, you can set any existing resource id value, for example, @ drawable/icon, @ string/OK, @ + string/you, etc. Of course, you can also set the existing resource id in the android system. For example, what does android mean by @ id/android: list proposed by the landlord? In fact, this android is the system's R class (in R. the package in the java file. You can enter android. R. id. In the Java code editing area to list the corresponding resource IDs. For example, you can also set the id attribute value to @ id/android: message. <ListView android: id = "@ + id/android: message" android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"/>
You can also view the IDS defined in the system and go to the <android sdk installation project
> \ Platforms \ android-1.5 \ data \ res \ values directory, find the ids. xml file, and open it with the following content:
<? Xml version = "1.0" encoding = "UTF-8"?> <Resources>
<Item type = "id" name = "price_edit"> false </item> <item type = "id" name = "amount_edit"> false </item> </resources>
If ids are defined in ids. xml, @ ID/price_edit can be defined as follows in layout; otherwise, @ + id/price_edit