【发布时间】:2016-04-22 12:38:23
【问题描述】:
我正在开发 android 应用程序。在我的应用程序中,我使用了 NavigationView。但它在主 xml 文件中显示 InflateException 并且应用程序被关闭。
我的代码在这里
<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" xmlns:app1="http://schemas.android.com/apk/res/com.example.xpressownernew">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The ActionBar -->
<include
layout="@layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- The main content view -->
<FrameLayout
android:id="@+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<!-- The navigation drawer -->
<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/drawer_view"
app:headerLayout="@layout/nav_header"
/>
</android.support.v4.widget.DrawerLayout>
如何解决这个问题?
【问题讨论】:
-
使用完整的 Stace Trace 发布您的代码。
-
需要堆栈跟踪、drawer_view.xml 和您的 nav_header。 xml.....
-
您只提供了部分信息。发布您的 logcat 和其他 xml 文件
标签: android navigationview inflate-exception