I updated android 6.0 and my application was having problems.
when the background color in the status bar is not white, the notification icon is good. (png notification icon has only white and alpha)
but if some applications change the background color to white, my notification icon is not inverted to black.
How can I invert the white notification icon to black when the background color in the status bar is set to white by another application? (I am not saying how I can use the color icon.)
The image below shows the problem.
normal status
when the background color changes to white, my icon does not change to black only
Notification Build Code
Notification.Builder mBuilder = new Notification.Builder(context) .setSmallIcon(R.drawable.ic_notifications_none) .setPriority(priority2) .setOngoing(true); mBuilder.setContent(generateMessageView(message)); Intent notificationIntent = new Intent(context, MainActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); mBuilder.setContentIntent(intent); mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
values-V23 / styles.xml
<style name="AppTheme" parent="android:Theme.Material.NoActionBar"> </style>
** Solution found **
I added notification icons to drawable directory not drawable- * dpi. Now it works.
source share