-1

I'm completely new to Android development so please excuse me if I ask silly questions but when I've created a Navigation Drawer project, activity_main.xml file is created:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />

</android.support.v4.widget.DrawerLayout>

I looked up the NavigationView class in hope to understand it a little more but it left me confused because I couldn't find the XML attribute app:headerLayout and app:menu in the documentation?

  1. What are the the differences between the android and app namespace?
  2. Why are the XML attributes with the app prefix not documented?
  3. Are there anymore hidden XML attributes I should be aware of that may not be documented? If so can you provide some references?
chaser
  • 3,107
  • 4
  • 29
  • 34

1 Answers1

0

NavigationView is a part of support library, and layouts which you are going to set, headerLayout or menu will be defined in your package, hence you have to use namespace with your package name or just use res-auto to automatically look into your package layouts.

Prashant
  • 112
  • 8