Inflate Bottom Navigation View menu programmatically

前端 未结 2 1400
臣服心动
臣服心动 2020-12-17 16:24

Bottom Navigation View has been added to version 25 of the Design Support Library. Tried and it\'s much easier to use now.

But I am facing problem implementing it a

2条回答
  •  暖寄归人
    2020-12-17 17:16

    BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    
    //Add MenuItem with icon to Menu
    navigation.getMenu().add(Menu.NONE, 1, Menu.NONE, "Home").setIcon(R.drawable.ic_home_black_24dp);
    

    Hope it helps.

提交回复
热议问题