Reputation: 33
In Android's own docs, and in the app I inherited, I sometimes see view IDs with the form
"@id/android:list"
and sometimes with the form
"@android:id/list"
That is, "android:" sometimes comes bewteen "@" and "id", and sometimes comes between "/" and the actual ID.
What are the meanings of those two forms? Are they equivalent?
Upvotes: 3
Views: 799
Reputation: 7663
Functionally I belive the the two are equivlant and will both look for android.R.id.list. They are just saying the same thing in a different way.
Resources in android are package specific. Saying @id/android:list will look for the list id within the android package. In this version, the package you are looking in is indicated by the :. In the second example @android:id/list you are defining the package first, the android package, and then telling it to look for id/list within that package.
This works just as it would were you to say @string/whatever or @id/blah. In those instances the system would look within your applications package for that resource. By placing android first, you're just telling it to look in the android package for those resources and not within your own applications resources folder.
I think this post also answers your question. It has some more detailed comments as well that might be helpful.
Upvotes: 3