Here is an example of the app
namespace that I've seen from a res/menu/main.xml
file
<menu 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"
tools:context=".MainActivity" >
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
What is the app
namespace here and what purpose does it serve? Is it a "standard" Android XML namespace? For a given attribute in the app
namespace (e.g., app:showAsAction
), are the same value options available as the same attribute in the android
namespace?
From the docs: android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"]
i.e., would the line in the above example mean something else if the attribute were instead:
android:showAsAction="never"
It almost looks like it might be some sort of "subclassing" mechanism, but I can't seem to find any real documentation on the app
namespace from Google/Android sources.
0 comments:
Post a Comment