2

I am using a navigation view and drawer layout in my app. As I tried to execute its throwing inflating exception. MinSdk it supports is 14.

Also theme I am using is appcompact no action bar.

Main activity:

    <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>

Exception:

android.view.InflateException: Binary XML file line #56: Error inflating class android.support.design.widget.NavigationView
Sid
  • 2,792
  • 9
  • 55
  • 111
  • Did you checked this link http://stackoverflow.com/questions/30709419/error-inflating-class-android-support-design-widget-navigationview I think it helps you – Arun Dey Sep 23 '16 at 12:33

1 Answers1

0

You should use only two layouts within a DrawerLayout. One layout for the main content, another layout for the drawer(i.e., NavigationView). Currently you have three layouts. Try removing the Framelayout and running the code.

Srijith
  • 1,695
  • 17
  • 29