Android KitKat: android.view.InflateException: Error inflating class android.support.design.widget.NavigationView

后端 未结 4 1574
日久生厌
日久生厌 2020-12-17 04:08

Below is my configuration. This works on Android Lollipop but crash on Android Kitkat.

I tried every workaround here but can\'t help:
Error inflating class and

4条回答
  •  余生分开走
    2020-12-17 04:38

    I used Activity Gallery in Android studio to create navigation drawer activity

    then I noticed that the template added images in a way that version 21 and above can understand, these images for menu items in navigation view

    and here is the error

    Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020052
    ......
    ......
    android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.prepareMenuItems
    

    and if you traced the Resource ID #0x7f020052 in R file

    you will find it belong to that image which android did no Recognize(find) it because it recognizable by android v21 not 19 or lower

    so add png images for pre-lollipop android devices

提交回复
热议问题