difference between @id and @android:id

The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource. The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R.java file). There are a number of other ID resources that are offered by the Android framework. When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace.

@+id/section_spinner means you are creating an id named section_spinner in the namespace of your application.
You can refer to it using @id/section_spinner .

@android:id/list means you are referring to an list defined in the android namespace.

The ‘+’ means to create the symbol if it doesn’t already exist. You don’t need it (and shouldn’t use it) when referencing android: symbols, because those are already defined for you by the platform and you can’t make your own in that namespace anyway.

Leave a Comment