original source : https://stackoverflow.com/a/26692768
The app
namespace is not specific to a library, but it is used for all attributes defined in your app, whether by your code or by libraries you import, effectively making a single global namespace for custom attributes – i.e., attributes not defined by the android system.In this case, the appcompat-v7
library uses custom attributes mirroring the android:
namespace ones to support prior versions of android (for example: android:showAsAction
was only added in API11, but app:showAsAction
(being provided as part of your application) works on all API levels your app does) – obviously using the android:showAsAction
wouldn’t work on API levels where that attribute is not defined.
original source : https://stackoverflow.com/a/38493589
Xmlns stands for ‘XML Namespace’
- The part after ’:’ is the prefix for the Namespace
- The part after ’=’ is the Namespace URI (the correct name for his part is actually “Namespace name”).
(For further details see https://en.wikipedia.org/wiki/XML_namespace)
The namespace ‘schemas.android.com/tools’ is for specifying options to build the app by Android Studio, and are not included in the final app package
The namespace ‘schemas.android.com/apk/res-auto’ is used for all custom attributes – defined in libraries or in code. See this answer for details.
Note that any prefix can be used for a namespace, it is not mandatory to use ‘app’ for schemas.android.com/apk/res-auto. But the same prefix must be used when defining the custom attributes in the document, otherwise an error will be shown.
So, because met_maxCharacters is a custom attribute, it is shown when the ‘schemas.android.com/apk/res-auto’ namespace is used, and not with
‘schemas.android.com/tools’