android - Notification Colour Icon Not Visible in Lollipop,It Show only a White background -


how visible notification icon without reduce target sdk version 20 >20. notification icon colour icon,not transparent. used below code not working in case of lollipop.it showing white background.

notificationcompat.builder builder = new notificationcompat.builder(this); if (android.os.build.version.sdk_int >= build.version_codes.lollipop) {     builder.setsmallicon(r.drawable.icon_colour); } else {      builder.setsmallicon(r.drawable.icon_colour); } 

android lollipop notification icons meant displayed in white style.

there documentation "android 5.0 behavior changes"

notifications drawn in dark text on white backgrounds (or light) match new widgets of design material.

this documentation suggests use color displayed behind (white) notification icon, says:

use setcolor () set highlight color in circle behind icon image.

your solution should used different rules each android version, using android.os.build.version.sdk_int >= build.version_codes.lollipop

try updating answer that:

if (android.os.build.version.sdk_int >= build.version_codes.lollipop) {     builder.setsmallicon(r.drawable.icon_no_colour);     build.setcolor(r.color.icon_background_color); } else {      builder.setsmallicon(r.drawable.icon_colour); } 

setcolor() documentantion


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -