Natan Rubinstein Natan Rubinstein - 6 months ago 322
Android Question

How to disable BottomNavigationView shift mode?

BottomNavigationView doesn't show menu's title that are inactive.

How to show titles of all menu elements in bottomNavigationBar?
The problem is that in my case shown only title of element that is clicked.

enter image description here


Implementation of BottomNavigationView has condition: when there is more than 3 items then use shift mode.

At this moment you cannot change it through existing API and the only way to disable shift mode is to use reflection.

You'll need helper class:

import java.lang.reflect.Field;

public class BottomNavigationViewHelper {
    public static void disableShiftMode(BottomNavigationView view) {
        BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0);
        try {
            Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
            shiftingMode.setBoolean(menuView, false);
            for (int i = 0; i < menuView.getChildCount(); i++) {
                BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
                // set once again checked value, so view will be updated
        } catch (NoSuchFieldException e) {
            Timber.e(e, "Unable to get shift mode field");
        } catch (IllegalAccessException e) {
            Timber.e(e, "Unable to change value of shift mode");

And then apply disableShiftMode method on your BottomNavigationView, but remember if you are inflating menu view from your code, you have to execute it after inflating.

Example usage:

BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(;


Remember, you'll need to execute this method each time you change menu items in your BottomNavigationView.