Difference between android: and app: prefix in Android XML?

android is usually used for attribute coming from Android SDK itself.

app is often used if you are using the support library.

You may also see other namespaces if you are using custom views (of your own or form a library).

Here is some extra information: http://developer.android.com/training/custom-views/create-view.html#customattr


app namespace is used for custom defined attributes, which are usually defined in /values/attrs.xml Here is a sample of such file

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="SimpleTabIndicator">
        <attr name="numberOfTabs" format="integer"/>
        <attr name="indicatorColor" format="color"/>
    </declare-styleable>
</resources>

And a sample usage would be

<com.someapp.demo.SimpleTabIndicator
    android:id="@+id/tabIndicator"
    android:layout_width="match_parent"
    android:layout_height="2dp"
    android:background="#26292E"
    app:indicatorColor="#FFFDE992"
    app:numberOfTabs="5"/>

Android namespace you use for Android's widgets and UI controls.


app is just a namespace for any custom parameters for a custom View.

This can be anything but if you see the root element there's probably a line xmlns:app="http://schemas.android.com/apk/res-auto" that assigns the namespace .