Xml naming difference between res-auto and com.package.name - android
I have seen custom xml with:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
and
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/com.package.custom"
What is the difference between these two guys?
- Is the latter just an indication of the default location like your package?
- Are the first paragraphs a link to a link?
thank.
+3
source to share
1 answer
If we add a new custom view and its attributes to our project, you add this to the beginning of your layout:
xmlns:custom="http://schemas.android.com/apk/res/your_main_app_package
If the new custom view is inside the library project associated with your project, you add the following:
xmlns:custom="http://schemas.android.com/apk/res-auto
Note. This issue has been fixed in version 17+ of ADT. For any service or action, declare the namespace as follows:
xmlns:custom="http://schemas.android.com/apk/res-auto"
The suffix res-auto
will be replaced at build time by the actual project package, so make sure you customize your attribute names to avoid conflicts if at all possible.
+3
source to share