1. When we use the control, sometimes it is unavoidable to declare the ID for the control, and scattered in the various XML files, sometimes it is not particularly convenient to find, so, Android has provided us with the Ids.xml file, saved in Res--valuse--Ids.xml In the file
2. Benefits of using the Ids.xml file
1. Convenient naming, we can put some specific controls first name, we use the time directly in our layout to set the ID, save a naming link. 2. When we write the code layout, when we set the ID, we need to use this method to name our control, it can be found in the R file to find the corresponding ID, and then to convert. Note: Each item in Ids.xml will also be generated into the R file, as the above Ids.xml will generate the following control in our R file: public static final class ID {public static final intbutton_ok=0x7f080000;public static final intdialog_exit=0x7f080001;When we use it, no matter which way you set the ID, it is the same: Findviewbyid (R.ID.XXX); 3. Format is ready to use
<?xml version= "1.0" encoding= "Utf-8"?><resources> <item type= "id" name= "logo" >false</item > <item type= "id" name= "showtext" >false</item></resources>
The use of Android--ids.xml files