0

As the title say when i launch i notify the small icon on the status bar doesnt change color to white and is almost invisible:

enter image description here

enter image description here

Notification n  = new Notification.Builder(this)
        .setContentTitle("title")
        .setContentText("lorem ipsum dolor sit amet")
        .setSmallIcon((R.drawable.logo_ntf))
        .setLargeIcon(icon)
        .setAutoCancel(true)
        //.addAction(R.drawable.transparent, null, null)
        .build();

2 Answers2

0

After ensuring transparency of your drawable file....

Try adding the following to the Notification.Builder pipeline:

.setColor(color);

color should be a resource int value, referring to a colour, like so:

int color = getResources().getColor(R.color.notification_color);

The non-deprecated way:

int color = ContextCompat.getColor(context, R.color.notification_color);

Source: setColor documentation

Imdad
  • 769
  • 1
  • 11
  • 31
0

For Android 5+, you have to create a transparent icon for notification small icon.

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    notification.setSmallIcon(R.drawable.icon_transperent);
    notification.setColor(getResources().getColor(R.color.notification_color));
} else { 
    notification.setSmallIcon(R.drawable.icon);
}

Check this for more

Liar
  • 1,235
  • 1
  • 9
  • 19