Android Bottom Navigation View Multicolor Icon
I have a bottom navigation view with 4 icons, one of which is a notification icon. I have to notify when new notifications appear, I do this by changing the icon programmatically to
Runtime problem: red dot is also gray. Icons are set to gray by default, and when selected, it takes the main color of the application (unless the icon color is set). If I set the IconTint color to red then the entire image is red instead of a red dot. I want to show the image as it is and not have a background effect on it. Is there a way to achieve this?
final Menu menu =bottomNavigationView.getMenu();
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
MenuItem notificationItem=menu.findItem(R.id.action_notification);
notificationItem.setIcon(R.drawable.notification_icon_with_badge);
}
});
thank
R
+3
source to share