自定义 Android 通知磁贴的背景 [英] Customizing the background of an Android notification tile

查看:40
本文介绍了自定义 Android 通知磁贴的背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到我的一个 Android 应用为其通知磁贴设置了自定义背景,如下面的屏幕截图所示:

I noticed that one of my Android apps has set a custom background for its notification tile, as you can see in the screenshot below:

此应用程序如何为其通知设置自定义背景?如何在自己的应用程序中实现相同的功能?

How did this application set a custom background for its notification? How can I achieve the same thing in my own application?

推荐答案

NotificationCompat
     .Builder(this, channelId)
     //...
     .setStyle(NotificationCompat.DecoratedCustomViewStyle())
     .setColor(resources.getColor(R.color.black))
     .setColorized(true)
     .build()

这篇关于自定义 Android 通知磁贴的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆