Implementing bottom navigation in android

How to use it.

1. Add the design support library

First step is to add the design support library to your app-level build.gradle file. Example is as shown below:

The BottomNavigationView uses design:menu is a custom attribute that points to the menu resource containing items to be shown on the BottomNavigationView.

There are other custom attributes for the view, including:

  • design:itemBackground to set the background of the menu resource
  • design:itemIconTint to set the tint which is applied to the item icons.
  • design:itemTextColor to set the menu item text colour.

3. Define the nav items in the menu resource

The BottomNavigationView is used in a very similar way to the NavigationView because the bottom nav view also uses menu resources to populate items.

To define the items, you need to do so in a menu resource. Let’s create one and name it bottom_nav_items.xml as we have specified in step 2 above.

A typical content will look like this:

This means that there will be 3 items, Home, Search and Notifications on the bottom nav view. We can run the app now, and we’ll see our neatly implemented bottom nav view.

Listening for events on the bottom nav view

Now that we’ve added the view, we’d love to know when a menu item is clicked right?

To listen for click events on the BottomNavigationView, we just need to call setOnNavigationItemSelectedListener()

Example of how to do this is:


Please share if you found this useful or it may help anyone who needs such a solution for placing bottom navigation bar in Android.

Thanks for reading.

Categories: Android


Leave A Reply

Your email address will not be published.