Error Inflating Class Android.Support.Design.Widget.Navigationview

Error inflating class android.support.design.widget.NavigationView

Actually it is not the matter of the primarycolortext, upgrading or downgrading the dependencies.This problem will likely occur when the version of your appcompat library and design support library doesn't match.

Example of matching condition

compile 'com.android.support:appcompat-v7:23.1.1' // appcompat library
compile 'com.android.support:design:23.1.1' //design support library

how fix Error inflating class android.support.design.widget.NavigationView

In your build.gradle there are some errors:

  • the support libraries 29.0.2 and 29.1.1 don't exist
  • you are using androidx and support libraries together and you can't do it.

Then, since you are using the androidx component <androidx.drawerlayout.widget.DrawerLayout you have to use the

<com.google.android.material.navigation.NavigationView
...>

instead of android.support.design.widget.NavigationView.

Finally check your App theme. You have to use a Material Component Theme.

Error inflating class android.suppot.design.widget.NavigationView'

try to change refractored.controls.CircleImageView instead of Refractored.Controls.CircleImageView in your header_layout :

<refractored.controls.CircleImageView
android:id="@+id/accoutImage"
android:layout_height="100dp"
android:layout_width="100dp"
android:layout_gravity="center"
android:src="@drawable/account"
android:scaleType="centerCrop"
/>

and :

   <android.support.design.widget.NavigationView>

instead of:

 <android.suppot.design.widget.NavigationView>

error in android: Error inflating class android.support.design.widget.NavigationView

Add the following dependency -

annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

Error inflating class android.support.design.widget.NavigationView when adding Drawer Navigation

I think that the problem is app:menu="@array/drawer_array" . You should be passing a menu instead of an array.

navigation view:

<android.support.design.widget.NavigationView
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_home"
app:menu="@menu/activity_home_drawer" />

under res/menu you will have activity_home_drawer.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<group android:checkableBehavior="single">
<item
android:id="@+id/nav_favorites"
android:icon="@drawable/ic_favorite_white"
android:title="@string/favorites" />

<item
android:id="@+id/nav_about"
android:icon="@drawable/ic_about"
android:title="@string/about" />
</group>


</menu>

Let me know if that works for you!

Android Error inflating class android.support.design.widget.NavigationView

The error Occure because When Create New Project from Android Studio.The all base thing is setup. There's a drawable folder named drawable-v21 which stores the icon xml files like this

ic_menu_send.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>

so When you are testing from below Api 21 you have put ic_menu_send.png file in your drawable folder to support below Api 21. Hope this will help you..



Related Topics



Leave a reply



Submit