I'm creating Android app using Xamarin for Android. I want to use in my app NavigationDrawer, so I downloaded and installed 'Android Design Library' from Xamarin Components Store. Then I edited my layout for this:
<?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"
android:id="@+id/drawerLayout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:fitsSystemWindows="true">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/articlesListView" />
<android.support.design.widget.NavigationView
android:id="@+id/navView"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/navHeader"
app:menu="@menu/navMenu"/>
</android.support.v4.widget.DrawerLayout>
navHeader.axml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="192dp"
android:background="?attr/colorPrimaryDark"
android:padding="16dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:orientation="vertical"
android:gravity="bottom">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Username"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
</LinearLayout>
and menu/navMenu.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_home"
android:title="Home" />
<item
android:id="@+id/nav_messages"
android:title="Messages" />
<item
android:id="@+id/nav_friends"
android:title="Friends" />
<item
android:id="@+id/nav_discussion"
android:title="Discussion" />
</group>
<item android:title="Sub items">
<menu>
<item
android:title="Sub item 1" />
<item
android:title="Sub item 2" />
</menu>
</item>
</menu>
Unfortunately while compiling, I received following error:
C:\Project\Project\File.axml: Error APT0000: No resource found that matches the given name (at 'headerLayout' with value '@layout/navHeader'). (APT0000) (AppName) C:\Projects\Project\File.axml(0,0): Error APT0000: No resource found that matches the given name (at 'menu' with value '@menu/navMenu'). (APT0000) (AppName)
Somebody knows how I may solved this problem?
Thank you in advance