NotificationCompat android - 如何只显示大图标而不显示小图标 [英] NotificationCompat android - how to show only Large icon without small

查看:28
本文介绍了NotificationCompat android - 如何只显示大图标而不显示小图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我添加通知时:

        NotificationCompat.Builder mBuilder =
                            new NotificationCompat.Builder(this)  
              .setSmallIcon(R.drawable.plus)
.setContentTitle(title)
.setAutoCancel(true) 
.setContentText(text)
.setSound(RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setLargeIcon(bm);

我看到大图标和小图标:

I see large icon and small in it:

如何只设置大图标,而不设置小图标.如果只使用 setLargeIcon,我根本看不到通知,只是发出警报.

How can I set only large Icon, without small. If use only setLargeIcon, I don't see notification at all, just sound alert.

推荐答案

小图标是强制性的.如果您不设置大图标,您将使用您选择的颜色 (setColor) 使圆圈中间的小图标变大.

Small icon is mandatory. If you don't set a large one you'll get your small icon bigger in the middle of the circle with the color of your choice (setColor).

如果我是你,我会将空白 E 放在小图标的透明背景上,并为圆圈设置红色.

If i were you i'd put that blank E on a transparent background for smallicon, and set a red color for the circle.

这篇关于NotificationCompat android - 如何只显示大图标而不显示小图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆