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