2
我想知道它是否可能具有与启动器或应用程序图标不同的Notificationbar图标。我想为我的推送通知显示其他图标。这可能吗?谢谢。Android - 更改通知图标
我想知道它是否可能具有与启动器或应用程序图标不同的Notificationbar图标。我想为我的推送通知显示其他图标。这可能吗?谢谢。Android - 更改通知图标
对于API < 11,构造函数Notification
允许使用icon to be specified。对于API> 10,Notifcation.Builder的setSmallIcon
和setLargeIcon
方法允许大致相同的事情。
Notification n = new Notification.Builder(this)
.setContentTitle("New mail from " + "[email protected]")
.setContentText("Subject")
.setSmallIcon(R.drawable.icon)
.setContentIntent(pIntent)
.setAutoCancel(true)
.addAction(R.drawable.icon, "Call", pIntent)
.addAction(R.drawable.icon, "More", pIntent)
.addAction(R.drawable.icon, "And more", pIntent).build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, n);
在上面的代码
setSmallIcon
和setSmallIcon
是变革的通知图标
哪个版本的API? – Estel 2012-07-07 23:39:53