Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:未找到属性';头部布局';包装内';com.example.materialdesignexample';_Android_Navigation Drawer_Android Drawer - Fatal编程技术网

Android 错误:未找到属性';头部布局';包装内';com.example.materialdesignexample';

Android 错误:未找到属性';头部布局';包装内';com.example.materialdesignexample';,android,navigation-drawer,android-drawer,Android,Navigation Drawer,Android Drawer,我使用的是eclipse,我添加了支持设计导航视图,如下所示 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourApp="http://schemas.android.com/apk/res/com.example.materialdesignexample.MainActivity" xmlns:app="

我使用的是eclipse,我添加了支持设计导航视图,如下所示

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:yourApp="http://schemas.android.com/apk/res/com.example.materialdesignexample.MainActivity"
    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" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:theme="@style/ThemeOverlay.AppCompat.Dark" />
    </RelativeLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/drawer" />

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

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

但我得到了这样的错误

错误:在包com.example.materialdesignexample中找不到属性headerLayout的资源标识符


请帮助我……

您必须从android SDK\extras\android\support\v7\appcompat导入support-v7-appcompat库

在eclipse中为design support library创建一个android库项目,并将目录android SDK\extras\android\support\design的内容放入design support library项目中 将appcompat-v7库链接到设计支持库项目 从您的项目链接支持库项目。 您不能直接使用jar android-support-design.jar,因为您也需要一些资源(这就是aar格式的原因)。


添加compile'com.android.support:design:25.2.0'

在您的父布局中,您可以看到这一行“xmlns”您可以完整地显示其中所写的内容吗感谢Shubhank回复“xmlns:app=”“xmlns:tools=”“尝试再添加一行类似于此的xmlns:yourApp=”“我添加了类似于此的行xmlns:com.example.materialdesignexample=”“但我还是犯了和以前一样的错误。。。但我还是犯了同样的错误