自定义推送通知 - 全宽背景颜色
我正在实施自定义推送通知。我有一个自定义布局,使用远程视图进行了修改。我已经使用了使用颜色
contentView.setInt(R.id.parentLayout, "setBackgroundColor", Color.parseColor("#4979C5"))
notifBuilder.setColor(Color.parseColor("#4979C5"))
.setColorized(true)
,但并未将颜色完全设置在背景上。我希望它具有这样的Android系统通知
但我得到了
这是我使用的样式:
notifBuilder.setColorized(true)
.setColor(Color.parseColor("#4979C5"))
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setContent(closedView)
.setCustomBigContentView(contentView)
.setSmallIcon(R.drawable.icon_tick)
我尝试使用其他样式并删除了该样式样式,但我得到了这个结果
似乎很好,因为它确实在完整的通知区域设置了背景颜色,但现在没有诸如应用程序名称,通知时间,应用程序图标和展开图标之类的详细信息。甚至动作按钮也消失了。
I am implementing custom push notifications. I have a custom layout, modified using RemoteViews. I have set color using
contentView.setInt(R.id.parentLayout, "setBackgroundColor", Color.parseColor("#4979C5"))
notifBuilder.setColor(Color.parseColor("#4979C5"))
.setColorized(true)
But it doesn't set color completely on background. I want it to have like this Android system notification
but I am getting this
Here is the styling that I have used:
notifBuilder.setColorized(true)
.setColor(Color.parseColor("#4979C5"))
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setContent(closedView)
.setCustomBigContentView(contentView)
.setSmallIcon(R.drawable.icon_tick)
I have tried using other styles and also removed the style but I get this result
Which seems to be fine as it does have background color set on complete notification area but now there is no details like app name, notification time, app icon and expand icon. Even action buttons are gone.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论