【发布时间】:2012-12-12 19:39:15
【问题描述】:
我使用这个简单的代码在 Android 4.1 或更高版本中设置通知。 它运作良好,但我的问题来自 SmallIcon 和 LargeIcon。 我了解 SmallIcon 显示在状态栏中,LargeIcon 显示在下拉列表中。
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setTicker("The ticker");
builder.setContentTitle("The title");
builder.setContentText("The text");
builder.setSmallIcon(R.drawable.my_small_icon);
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.my_96px_large_icon);
builder.setLargeIcon(bm);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nm.notify("direct_tag", NOTIF_ALERTA_ID, builder.build());
我的问题是:
启动通知时,“The Ticker”文本旁边会显示一个裁剪过的超大小图标,而不是显示原始的 SmallIcon 而不会超大。
在下拉列表中,我看到了左侧的 LargeIcon,这很好。但我也看到右侧的小图标,在通知时间旁边。我不想表现出来。
【问题讨论】:
-
我在解决这个问题时遇到了困难,您能否澄清一下有什么必要?接受的答案并没有完全告诉我该怎么做
-
@AndrewBullock -
builder.setSmallIcon(0);对你有用吗?它应该在使用大图标时禁用小图标。 -
为什么不直接设置全透明图片文件?
标签: android notifications icons