简体   繁体   中英

Bottom Navigation Bar not showing icons

I am initializing all of the icons with images but none of them are visible?

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

    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/nav_item1"
        android:icon="@drawable/insta"
        app:showAsAction="ifRoom|withText"

        android:title="@string/nav1"/>
    <item
        android:id="@+id/nav_item2"
        android:icon="@drawable/artistsample"
        app:showAsAction="ifRoom|withText"
        android:title="@string/nav2"/>
    <item
        android:id="@+id/nav_item3"
        android:icon="@drawable/artistsample"
        app:showAsAction="ifRoom|withText"
        android:title="@string/nav3"/>
    <item
        android:id="@+id/nav_item4"
        android:icon="@drawable/artistsample"
        app:showAsAction="ifRoom|withText"
        android:title="@string/nav4"/>

</menu>

Can you please use the bellow code and see what happens.

<item
    android:id="@+id/nav_item2"
    android:icon="@drawable/artistsample"
    android:title="@string/nav2"/>

and enable app:labelVisibilityMode="labeled" in BottomNavigationView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM