H2O
H2O

Reputation: 592

Android bottomviewnavigation adding png icon to new item

Opened a new project with a Bottom Navigation activity template in Android Studio.

When i try to change icon of one of the menu items with a 32x32 png file, it works on all emulator and real devices with api level > 21 but crashes on JellyBean

<item
    android:id="@+id/navigation_home"
    android:icon="@drawable/phone" //32x32 png file cause a crash for api level < 19
    android:title="@string/title_home" />

<item
    android:id="@+id/navigation_dashboard"
    android:icon="@drawable/ic_dashboard_black_24dp" //this works normally
    android:title="@string/title_dashboard" />

jellybean crashes and give this error

android.view.InflateException: Binary XML file line #19: Error inflating class android.support.design.widget.BottomNavigationView

i couldnt find any information at here

so how can i edit a menu item with an image

Upvotes: 2

Views: 731

Answers (1)

peshkira
peshkira

Reputation: 6229

You have probably put the png file in the wrong folder. Please recheck if it is in all the correct folders and try again.

Upvotes: 1

Related Questions