Skip to content Skip to sidebar Skip to footer

Difference In Naming Xml Between Res-auto And Com.package.name - Android

I have seen custom xml with :

Solution 1:

If we add a new custom view and its attributes inside our project, you add this at the beginning of your layout:

xmlns:custom="http://schemas.android.com/apk/res/your_main_app_package

If the new custom view is inside a library project linked to your project, you add this:

xmlns:custom="http://schemas.android.com/apk/res-auto

Note: This problem has been fixed in ADT revision 17+ . For any services or Activities, declare the namespace as follows:

xmlns:custom="http://schemas.android.com/apk/res-auto"

The suffix res-auto will be replaced at build time with the actual project package, so make sure you set up your attribute names to avoid collisions if at all possible.

Post a Comment for "Difference In Naming Xml Between Res-auto And Com.package.name - Android"