Ad

My Bottom Navigation View Isnt Visible Even After Coding Correctly,

I have coded for the bottom navigation view but it doesn't work for my current project however if I use the same code in another project it is visible. Also the default background of my activity comes as black for my current project.

Here's my XML file:

My XML file looks like this

And here are my menu's content

And the Bottom Menu looks like this

Ad

Answer

First of all, you need to add the design support library to your app-level build.gradle file. For Exemple:

dependencies {
    ...
    implementation 'com.android.support:design:28.0.0'
}

Then click the Sync Now button. Also, you need to complete other attributes in your activity_h2.xml like this

<android.support.design.widget.BottomNavigationView
       android:id="@+id/navigation"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="start"
       design:menu="@menu/bottom_navigation" />

PS: The android:id="@+id/navigation" is important to listening for events on the bottom navigation in your h2.java

Ad
source: stackoverflow.com
Ad