Notification bar icon turns white in Android 5 lollipop

Source: Internet
Author: User
Tags transparent color

Analysis of the problem see blog: http://www.cnblogs.com/avenwu/p/4180193.html
from http://stackoverflow.com/questions/28387602/ Notification-bar-icon-turns-white-in-android-5-lollipop see the answer and try to succeed. Only a white pattern is implemented. Be sure to follow the settings exactly below.
to avoid Notification icons to turn white, with "Silhouette" icons for them, ie. white-on-transparent background image S. Use IrfanView to build them:

 Choose a picture, open in [IrfanView] (http://www.irfanview.com/), press F12 for the painting T  Ools, clean picture if necessary (remove unwanted parts, smooth and Polish) Image/decrease Color Depth to **2** (for A black & white picture] image/negative (for a white in black picture) (//not quite clear what meaning, you can choose All channel) image/r Esize/resample to 144 x 144 (**use Size method "Resize" * * not "resample" otherwise the picture is increased to color bits per pixel (BPP) again file/save as PNG, check Show option dialog, check **save transparent, click Save, T Hen click on the ' black ' color in the ' image to set **the transparent color** 

The Android seems to is using the DRAWABLE-XXHDPI picture resolution (144 x 144) only and so copy your resulting. PNG file to \androidstudio\projects...\app\src\main\res\drawable-xxhdpi. Use. Setsmallicon (r.drawable.ic_notification) into your code, or use Getnotificationicon () as Daniel Saidi suggested.

private int Getnotificationicon () {
    Boolean Usewhiteicon = (Android.os.Build.VERSION.SDK_INT >= Android.os.Build.VERSION_CODES. Lollipop);
    Return Usewhiteicon? R.drawable.icon_silhouette:r.drawable.ic_launcher;
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.