我正在使用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的资源标识符
请帮助我.....
答案 0 :(得分:0)
您必须从android-sdks \ extras \ android \ support \ v7 \ appcompat导入support-v7-appcompat库。
在eclipse中为设计支持库创建一个android库项目,并将目录android-sdks \ extras \ android \ support \ design的内容放入设计支持库项目中 将appcompat-v7库链接到设计支持库项目 链接项目中的支持库项目。 你不能直接使用jar android-support-design.jar,因为你也需要一些资源(这就是aar格式的原因)。
答案 1 :(得分:0)
add compile&#39; com.android.support:design:25.2.0&#39;