我正在尝试在我的应用中实现导航抽屉,但当我尝试引用我的'@ menu / navigationdraweritems'文件时,我收到错误:
Error:(26) No resource identifier found for attribute 'menu' in package 'com.t99sdevelopment.centralized'
这是我的XML ......
<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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nvView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
app:menu="@menu/navigationdraweritems" />
</android.support.v4.widget.DrawerLayout>
也...
My gradle dependency: com.android.support:appcompat-v7:23.1.0
有什么想法吗?
答案 0 :(得分:12)
要使android.support.design.widget.NavigationView
起作用,您需要在build.gradle中添加设计依赖项:
compile 'com.android.support:design:23.1.0'