如何在安卓系统中改变通知背景颜色?

9
我该如何在安卓系统中更改通知颜色?我尝试了这段代码,但它只更改了标题和图标的颜色。
NotificationCompat.Builder(mContext,NOTIFICATION_CHANNEL_ID).setColorized(true).setColor(Color.parseColor("#f7da64")

enter image description here


https://stackoverflow.com/questions/28363247/lollipop-notification-background-color - AskNilesh
可能有重复:https://dev59.com/F5jga4cB1Zd3GeqPI1qF#38022837 - Faysal Ahmed
1个回答

3
  1. 确保在清单文件的应用标签以及所有样式文件(style.xml、style.xml(v21))中使用的主题/颜色是一致的。

    • application tag of manifest file
    • all style files (style.xml,style.xml(v21))
  2. 确保在notificationBuilder.setColor(mNotificationColor)中,mNotificationColor确实指向了预期的颜色代码。

  3. 检查是否按照以下方式设置了meidastyle:

    .setStyle(new MediaStyle() .setShowActionsInCompactView( new int[]{playPauseButtonPosition})in compact view .setMediaSession(mSessionToken))


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接