I have a BottomNavigationView
that provides a tabbar on Android. I want to change the icon of it programatically which I've tried to do using the following
BottomNavigationItemView organisationTab = findViewById(R.id.navigation_dashboard);
organisationTab.setIcon(getResources().getDrawable(R.drawable.tab_bank_feeds_uk));
This works but when i select any item on the tabbar, it reverts back to the original.
I tried to set it again on the onclick listener but it keeps reverting back to the original, i've tested this on a blank project to make sure nothing in my current code is doing anything weird.
Any help would be appreciated.
You can set the NaviagtaionViewItem
by getting its order in the BottomNavigationView
menu
bottomNavigationView.getMenu().getItem(0).setIcon(R.drawable.tab_bank_feeds_uk);