1

I'm trying to understand the various Android XML namespaces, including

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
  • They appear to be standard namespaces, but are these namespace URIs also standard? That is, can they be different from the URIs above?
  • If these are indeed standard namespaces, what are the elements defined within these namespaces? From browsing the documentation, it seems that the android namespace elements are defined on a per-resource basis. For example, if I'm interpreting the docs currently, in the context of a menu resource, the elements available are id, title, titleCondensed, showAsAction, etc. But, sometimes I see the showAsAction element declared as the app:showAsAction, so I'm confused.
  • Where in the Android libraries are these namespaces defined?

I've been searching for documentation on Android XML namespaces to find answers to these questions and to learn how to better use them, but especially for xmlns:app and xmlns:tools, any reference of these namespaces I'm coming across are in Stack Overflow questions and not in any official Android docs. I'm wondering if someone can help me out.

coder123
  • 9,267
  • 5
  • 16
  • 13
  • Check : http://stackoverflow.com/questions/7119359/why-this-line-xmlnsandroid-http-schemas-android-com-apk-res-android-must-be – Haresh Chhelana Oct 29 '14 at 06:26
  • Thanks. But I do understand why an XML namespace is necessary in the first place. Why would I want to use `app:showAsAction`, for example, instead of what seems to be the standard `android:showAsAction`? What are the `app` and `tools` namespaces? I still can't find answers to these questions. – coder123 Oct 29 '14 at 06:33
  • android:showAsAction is an attribute defined by the framework, whereas app:showAsAction is defined by your app. These are completely independent attributes and may contain different values. – alanv Oct 29 '14 at 22:41

0 Answers0