我正在爲應用程序創建用戶通知。我想讓圖標在狀態欄中顯示爲白色,但在下拉通知菜單中顯示時顯示爲藍色。以下是Google商店應用所執行的相同事情的示例。在狀態欄Android顏色通知圖標
白通知:
我怎麼能複製這樣的:在下拉菜單中
有色通知?我必須設置哪些屬性?
編輯: 這裏是我當前的代碼 - 我所做的圖像都是白色透明背景,所以它看起來很好在狀態欄,但在通知中下降,圖像仍然是相同的白色:
private NotificationCompat.Builder getNotificationBuilder() {
return new NotificationCompat.Builder(mainActivity)
.setDeleteIntent(deletedPendingIntent)
.setContentIntent(startChatPendingIntent)
.setAutoCancel(true)
.setSmallIcon(R.drawable.skylight_notification)
.setColor(ContextCompat.getColor(mainActivity, R.color.colorPrimary))
.setContentTitle(mainActivity.getString(R.string.notification_title))
.setContentText(mainActivity.getString(R.string.notification_prompt));
}
我能解決這個問題 - 請我的回答如下。 – Oblivionkey3