2016-09-23 4 views
2

私のアプリでナビゲーションビューと引き出しレイアウトを使用しています。私は例外を膨らませる例外を実行しようとしました。それをサポートするMinSdkは14です。ナビゲーションビューのインフレータ例外の取得

私が使用しているテーマは、appcompact no action barです。

主な活動:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/container"> 
    </FrameLayout> 

    <!-- Your normal content view --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:id = "@+id/toolbar_container"> 

     <!-- We use a Toolbar so that our drawer can be displayed 
      in front of the action bar --> 
     <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:id="@+id/main_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 

      android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/Contacts" 
      android:layout_gravity="center" 
      android:id="@+id/toolbar_title" 
      android:textSize="20sp" 
      android:textColor="#ffffff" 
      android:textStyle="bold" 
      android:gravity="center" /> 
     </android.support.v7.widget.Toolbar> 

     <android.support.v7.widget.RecyclerView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#ffffff" 
      android:id="@+id/recycler_view" 
      android:layout_alignParentStart="true" 
      android:layout_alignParentLeft="true" /> 
     <!-- The rest of your content view --> 

    </LinearLayout> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/navigation_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     android:background="?attr/colorPrimary" 
     app:headerLayout="@layout/drawer_header" 
     app:itemTextColor="@color/yourColor" 
     app:itemIconTint="@color/yourColor" 
     app:menu="@menu/nav_menu" > 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <include 
       layout="@layout/drawer_header" 
       android:layout_width="match_parent" 
       android:layout_height="103dp" /> 

      <ExpandableListView 

       android:id="@+id/elvGuideNavigation" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:groupIndicator="@null" 
       /> 

     </LinearLayout> 

    </android.support.design.widget.NavigationView> 



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

例外:

android.view.InflateException: Binary XML file line #56: Error inflating class android.support.design.widget.NavigationView 
+0

は、あなたがこのリンク http://stackoverflow.com/questions/30709419/error-inflating-class-android-support-design-widget-navigationview 私はそれはあなたに –

答えて

0

あなたはDrawerLayout内のみ2つのレイアウトを使用する必要があります。メインコンテンツの1つのレイアウト、引き出しの別のレイアウト(つまり、NavigationView)。現在、3つのレイアウトがあります。 Framelayoutを削除してコードを実行してみてください。

+0

を助け考えても私は同じことにショックを受けていますを確認しませんでしたコードは以前のバージョンで動作します。 @Srijith N – Sid

+0

フレームレイアウトを取り除いても、同じ例外がスローされます。@ Srijith N – Sid

+0

あなたのXMLをチェックさせてください – Srijith

関連する問題