Search code examples
androidandroid-drawablebottomnavigationviewandroid-custom-drawable

BottomNavigationView change item Icons with different tint colors


The title may seem a bit confusing, sorry didn't know how to make it one line question.

I have a custom Drawable with different colors. However, when applied on a BottomNavigationView the btv applies tint on it and now it looks awful. Any way to solve this?

The thing is, because clicking on that specific drawable with colors will popup a BottomSheetDialog, I don't care about the color when pressed. Just that the drawable retains its own colors.


Solution

  • You can use bottomNavigationView.setItemIconTintList(null); to disable default tint color, then onNavigationItemSelected(@NonNull MenuItem item) you can change the drawable item.setIcon(getResources().getDrawable(R.drawable.new_drawable));

    For more useful info check the docomentations.