When Should I Use @android:id/?
I've found some code examples with the @android:id/xyz attribute set instead of @+id/xyz. When and why is it necessary to use Android ids instead of the user's id?
Solution 1:
The plus-symbol means that the resource is new and it must be created and added to the resources in the R.java
file.
Omitting the plus symbol references an already existing resource.
Solution 2:
@android:id
indicates that the id is in the Android.r.id namespace
. So this is useful for ListActivities where they look for Android.r.id.list
by default.
Solution 3:
@android is used to access the default resources of Android . For example see this:
android:background="@android:color/transparent"
Using + sign means this resource must be added in R.java file while not using + sign means the resource already exist in R.java.
Post a Comment for "When Should I Use @android:id/?"