This page定义了一个元素ID如下:为什么Android文档中有不同的id语法?
<TextView android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:" />
然而this page将其定义为:
<EditText id="text"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:textColor="@color/opaque_red"
android:text="Hello, World!" />
我原本以为发生了什么事情,直到我看到这个体面的理解第二个例子。在第一种情况下,您需要+字符,以便将id'label'添加到R文件,对吗?在第二种情况下,EditText的ID是否不会被添加到R文件中,因为它不包含+字符?
此外,第二个示例不包含id上的android命名空间。具有或不具有Android名称空间会影响该ID是否会添加到R文件中?
感谢您的任何澄清。