因为我添加了一个新活动(使用导航抽屉),当我调用此活动时,我收到错误:
Unable to start activity ComponentInfo{com.eu.study.myapp.tutorial/com.myapp.tutorial.welcome}: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
我在android 6.0上没有错误,我在旧版本上遇到错误,如4.1.2
<android.support.design.widget.NavigationView //error here at line 16
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_welcome"
app:menu="@menu/activity_welcome_drawer" />
我添加了这两件事,但错误未修复:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'