how to change the icons of the notification bar on android

2

I want to change the color of the icons of notifications in the status bar and I do not know which property the color changes.

    
asked by jonatan diaz 14.05.2018 в 22:30
source

2 answers

1

If you use the operating system or later, the development guidelines say:

Colors: Color notification icons must be completely white. In addition, the system can reduce and / or darken icons.

You can apply a color or tint but it will not affect the color of the icon.

Instead, you can only change the color of the icon when the notification is expanded, using the setColor () .

Example:

    int color = 0x00FF00;
    NotificationCompat.Builder nb = new NotificationCompat.Builder(this);
            nb.setContentTitle(getString(R.string.title))
            .setContentText(getString(R.string.content))
            .setSmallIcon(R.drawable.ic_androide)
            .setLargeIcon(bitmap_image)
            .setColor(color)   /* define Color */
            .setTicker("Hai Romania!")
            .setStyle(style)
            .build();

    
answered by 15.05.2018 / 02:26
source
2

Requires min API 23

<item name="android:windowLightStatusBar">true</item>
    
answered by 06.12.2018 в 03:42