What is the diffirence between the
@id/
and@+id/
?
In @+id/
the plus symbol
Sometimes you see references in your layout files like:
and
What's the difference?
.. I'm glad you asked ☺
@+id/foo
means you are creating an id named foo in the namespace of your application.
You can refer to it using @id/foo
.
@android:id/foo
means you are referring to an id 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.
This namespace is the namespace of the framework.
for example, you need to use @android:id/list
because this the id the framework expects to find.. (the framework knows only about the ids in the android namespace.)
Completely copied from this source