why is there different id syntax in the Android docs?

Posted by darren on Stack Overflow See other posts from Stack Overflow or by darren
Published on 2010-04-07T20:50:07Z Indexed on 2010/04/07 20:53 UTC
Read the original article Hit count: 219

Filed under:

This page in the Android documentation defines an element id as follows:

<TextView android:id="@+id/label" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:text="Type here:" />

However this page defines it as:

<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!" />

I thought I had a decent understanding of what was going on until I saw this second example. In the first case, you need the + character so that id 'label' is added to the R file, correct? In the second case, would the EditText's id not be added to the R file because it does not contain the + character?

Also, the second example does not include the android namespace on the id. Does having or not having the Android namespace affect whether that id will be added to the R file?

Thanks for any clarification.

© Stack Overflow or respective owner

Related posts about android