MickaelG
MickaelG

Reputation: 322

How to tint icons of MediaStyle notification actions?

In my application I have a media notification (using the MediaStyle) and I need to have action icons with different tints. An example of what I want to achieve is the Spotify notification running on Android N:

Spotify notification example

The Previous action icon doesn't have the same color than the other actions. I know I can tint all of them with NotificationCompat.Builder.setColor() method, but how can each action icon have a different color/tint?

Upvotes: 1

Views: 801

Answers (1)

MickaelG
MickaelG

Reputation: 322

Finally found the solution. Starting from Lollipop, Android only use the alpha from drawables and apply its own color on them. The Spotify app use a black color, and with some alpha they can have a grey icon. So by tweaking the alpha of the used drawables, it's possible to have different tints on action icons.

Upvotes: 3

Related Questions