使用Android设计支持库中的NavigationView
我正在尝试使用设计支持库中的新抽屉布局 Android studio似乎没有识别NavigationView布局 这是我的主要活动布局:使用Android设计支持库中的NavigationView,android,android-studio,android-support-library,drawerlayout,navigationview,Android,Android Studio,Android Support Library,Drawerlayout,Navigationview,我正在尝试使用设计支持库中的新抽屉布局 Android studio似乎没有识别NavigationView布局 这是我的主要活动布局: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_wid
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer_menu"/>
</android.support.v4.widget.DrawerLayout>
当我试图运行项目时,我会遇到下一个错误:
错误:(19)未找到属性“headerLayout”的资源标识符
但是我确实有这个抽屉头xml文件我的坏
当然,您应该将android支持设计库导入到您的项目中
因此gradle(应用程序)中的“依赖项”区域应如下所示:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
}
能否添加活动和标题布局代码?