通知上的小图标无法正常工作

时间:2018-11-02 16:25:28

标签: android notifications android-drawable

我一直在努力设置适当的小图标来进行通知。一段时间以来,我认为只能在顶部栏上显示白色图标,但是由于错误(键入错误的drawable id),我注意到它还可以添加彩色图像: enter image description here

但是在向下滑动顶部栏之后,第二个可见图标的地方都是灰色(大灰点): enter image description here

是否可以将深灰色圆圈更改为适当的small_icon?

我的代码:

 NotificationCompat.Builder b = new NotificationCompat.Builder(context, "default");
 b.setAutoCancel(true)
            .setDefaults(NotificationCompat.DEFAULT_ALL)
            .setWhen(System.currentTimeMillis())
            .setSmallIcon(R.drawable.pck_sign)
            .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.pck_sign))
            .setTicker("{Time to watch some cool stuff!}")
            .setContentTitle("My Cool App")
            .setContentText("Time to watch some cool stuff!")
            .setContentInfo("INFO")
            .setContentIntent(pendingI);

1 个答案:

答案 0 :(得分:2)

发生这种情况是因为图标大小不正确,请查看此文档:

https://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar