developer
developer

Reputation: 329

How to show notification icon in colored one in android lollipop version

I'm making one application, notification icon in Lollipop is showing while, for my knowledge I know that Lollipop shows that icon in white color, but I saw that other application is showing icon in colored one. How to do that? I want my icon to be colored in Lollipop. If anyone knows a solution please let me know.

I have attached image for notification icon

Upvotes: 2

Views: 2691

Answers (2)

capt.swag
capt.swag

Reputation: 10661

If you are using API Level 21 or higher, you should not be using such a notification icon, since it is against Lollipop's Notification design guidelines.

This is how notification icon looks in Lollipop and above

enter image description here

There will be a single icon and you can call setColor() method to set the desired color to the surrounding. In this image which is RED.

But if you are not considering it right now. Then you should lower the targetSdkVersion below 21 in your build.gradle file.

targetSdkVersion 20 

So it's not recommended to show the notification icon colored as the one you mentioned.

Upvotes: 0

Gex
Gex

Reputation: 2202

If you change your targetSdkVersion in gradle or manifest file below 21, the notification icon will be colorful. (From sdk level 21 there is a white filter on the notification icon.)

Gradle:

android {
    defaultConfig {
        targetSdkVersion 20
    }
}

Manifest:

<uses-sdk
    android:targetSdkVersion="20" />

Upvotes: 2

Related Questions