将 Android 通知图标设置为远程 URL [英] Setting an Android Notification Icon to a remote URL
问题描述
我想对通知图标使用远程 URL(如 favicon),但是通知的构造函数只接受资源 ID(整数)而不是更有用的东西,例如 FileInputStream代码>.
I want to use a remote URL (like a favicon) for a notification icon, however the constructor for a notification accepts only a resource ID (which is an integer) instead of something more useful like a FileInputStream
.
我该怎么办
为流源定义一个新资源
define a new resource for a stream source
下载一个图标,添加到我的资源中,然后动态获取一个ID?
download an icon, add to my resources, and then dynamically get an ID?
推荐答案
自 API 11 以来,Android 已经能够将位图用于 largeIcon 在通知中.这在 Jelly Bean 中得到了进一步扩展,允许整个通知成为一个图像,BigPictureStyle.
Since API 11 Android has had the ability to use a Bitmap for a largeIcon in notifications. This has been expanded even further in Jelly Bean to allow entire notifications to be an image, BigPictureStyle.
这篇关于将 Android 通知图标设置为远程 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!