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 purpose does the app
namespace serve? Is it a "standard" Android XML namespace? Are the same value options available for the same attribute placed in two different namespaces (e.g. app:showAsAction
and android:showAsAction
).
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.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…