Android Color Notification Icon
I found the answer to my question here: https://stackoverflow.com/a/44950197/4394594
I don't know entirely what the problem was, but by putting the huge png that I was using for the icon into the this tool https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=image&source.space.trim=1&source.space.pad=0&name=ic_skylight_notification
and by placing the generated icons it gave into my mipmap folder, I was able to get the setColor(...)
property to work correctly.
Why is the color for the notification icons generated by Android Image Asset Studio completely white?
As per the guidelines, notification icons are monochrome and tinted via the setColor
API, so it is expected that they are a solid white color.
How to support multiple colors (more than two color) for Android Notification icon?
If your app targets SDK 21+ the system will always tint your notification icon
- white when it's displayed in a dark status bar
- dark grey when it's displayed on a light status bar (API 23+)
- dark grey when it's collapsed at the bottom of the notification shade
- the color you set when it's part of a notification in the notification shade (API 24+, before that you'd have a white icon over a colored circle as the default large notification icon)
You have no control over the color other than what's described above.
But you can work with alpha channel. You can achieve different degrees of white/dark grey/color in your icon.
No, there's no other way. Pass this on to your designer and management.
Android 5.0 Behavior Changes
Notifications
Material design style
- Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.
Source: https://developer.android.com/about/versions/android-5.0-changes.html#NotificationsMaterialDesignStyle
Android - Notification icon color not affected by setColor
Downscaling the icon to exactly 48x48 pixels suddenly made the correct color appear.
I still don't understand this undocumented behavior.
Related Topics
The Activity Must Be Exported or Contain an Intent-Filter
How to Update One Field from All Documents Using Pojo in Firestore
Httpurlconnection.Getresponsecode() Returns -1 on Second Invocation
How to Close Another App in Android
== and .Equals() Not Working in Java
Android: Cannot Perform This Operation Because the Connection Pool Has Been Closed
How to Create Button Dynamically in Android
Get Button Coordinates and Detect If Finger Is Over Them - Android
How to Install "Android Support Library" to Deploy a Gluon Mobile Application to Android
Java to Ruby Aes/Ecb/Pkcs5Padding Encryption
How to Get String Response from Retrofit2
Using Asynctask with Passing a Value
How to Transform Currenttimemillis to a Readable Date Format
Why Menuitemcompat.Getactionprovider Returns Null
Nullpointerexception on Button.Findviewbyid()