By default, BottomNavigationView
starts with an empty menu. You can use the getMenu()
method to get the Menu instance, then add menu items as in the response above. For example,
BottomNavigationView bottomNavigation = findViewById(R.id.bottom_navigation);
Menu menu = bottomNavigation.getMenu();
menu.add(Menu.NONE, MENU_ITEM_ID_ONE, Menu.NONE, getString(R.string.str_menu_one))
.setIcon(R.drawable.ic_action_one);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…