android @id和@+id的问题
伊谢尔伦
伊谢尔伦 2017-04-17 16:51:43
0
2
404
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
迷茫

As you know, when we define an id for a control in xml, we use @+id/xxx. If it does not exist in R.java, the corresponding xxx variable name and value will be generated as int. If it exists, it will be used. The original int value, so each xxx has a unique identifier.
However, when we define the ids.xml file in the resource file, we can customize the variable name of the id type in the form:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="cc" type="id">213</item>
</resources>

So we can quote it as follows in the layout file:

<Button
    android:id="@id/cc"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
    

As for what you said about @id/xxx referencing the same, it is the same as @+id/xxx.

左手右手慢动作

It is also possible that a set of IDs has been customized under the values ​​folder. This can also be referenced directly using @id/xxx
<resources>

<item name="navigation_view" type="id" />

</resources>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!