Remove BottomNavigationView labels Remove BottomNavigationView labels android android

Remove BottomNavigationView labels


I hope I am not too late to the party here.

But as of Design Support Library 28.0.0-alpha1you can use the property

app:labelVisibilityMode="unlabeled"

BottomNavigationView without labels

you can use other values "auto", "labeled" and "selected" as well.


Unfortunately this first version of BottomNavigationView came with a lot of limitations. And for now you can't remove the titles just using the support design API. So to solve this limitation while google doesn't implement it, you can do (using reflection):

1. Set the titles empty in from bottom_navigation_menu.xml file.

2. Extends the BottomNavigationView:

    public class MyBottomNavigationView extends BottomNavigationView {      public MyBottomNavigationView(Context context, AttributeSet attrs) {          super(context, attrs);          centerMenuIcon();      }      private void centerMenuIcon() {          BottomNavigationMenuView menuView = getBottomMenuView();          if (menuView != null) {              for (int i = 0; i < menuView.getChildCount(); i++) {                BottomNavigationItemView menuItemView = (BottomNavigationItemView) menuView.getChildAt(i);                AppCompatImageView icon = (AppCompatImageView) menuItemView.getChildAt(0);                FrameLayout.LayoutParams params = (LayoutParams) icon.getLayoutParams();                params.gravity = Gravity.CENTER;                menuItemView.setShiftingMode(true);              }          }      }      private BottomNavigationMenuView getBottomMenuView() {          Object menuView = null;          try {              Field field = BottomNavigationView.class.getDeclaredField("mMenuView");              field.setAccessible(true);              menuView = field.get(this);          } catch (NoSuchFieldException | IllegalAccessException e) {              e.printStackTrace();          }          return (BottomNavigationMenuView) menuView;      }    }

3. Add to the layout.xml this customView

For more details I have implemented this on Github