邢台建设网站,内蒙古建设工程信息网,四川招标采购交易信息网,网站的营销推广方案及预算接受的答案不完全正确。当然#xff0c;它会使通知图标显示颜色#xff0c;但是这样做有一个很大的缺点-将目标SDK设置为比AndroidLolliop低#xff01;如果您按照建议将目标SDK设置为20来解决您的白色图标问题#xff0c;您的应用程序将不会针对AndroidLolliop#xff0c…接受的答案不完全正确。当然它会使通知图标显示颜色但是这样做有一个很大的缺点-将目标SDK设置为比AndroidLolliop低如果您按照建议将目标SDK设置为20来解决您的白色图标问题您的应用程序将不会针对AndroidLolliop这意味着您不能使用特定于Lolliop的功能。因此我认为一个更好的解决方案是在应用程序中添加一个剪影图标并在该设备运行AndroidLolliop时使用它。例如Notification notification new Notification.Builder(context).setAutoCancel(true).setContentTitle(My notification).setContentText(Look, white in Lollipop, else color!).setSmallIcon(getNotificationIcon()).build();return notification;在getNotificationIcon方法中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;}