创建保存图标的通知 [英] Create a notification with saved icon

查看:125
本文介绍了创建保存图标的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序的用户从安装在应用程序列表中选择一个应用程序
他们的电话。

In my application the user pick an application from list of applications installed on their phone.

我想创建一个通知与已选定的应用程序的图标。

I want to create a notification with an icon of the choosen application.

问题是,我不能保存图标我的应用程序里面,如果我保存它somethere否则我将无法获得通过ID的图标,因为它需要创建一个通知。

The problem is that I can't save the icon inside my application, and if I save it somethere else I won't be able to get the icon by id, as it needed to create a notification.

我该如何解决呢?

推荐答案

您不能添加或编辑res文件夹的资源。而作为通知的主要图标,图标ID提供,所以你不能用动态图像,从程序改变。但在通知另一个图标的选择。这是一个小图标(althgouh它被称为大图标!不知道为什么),在通知的右侧。您可以通过发送位图作为参数设置。

you can not add or edit the resource of res folder. And as the main icon of notification is provided as an icon id so you can not change by dynamic images from program. But there is another icon option in the notification. it is a small icon (althgouh it is called large icon!! dont know why) at the right side of the notification. you can set it by sending Bitmap as parameter.

您可以看到这个图标在这个链接。看到普通视图数6。

you can see the look of this icon in this link. see the number 6 of normal view.

要设置这个图标,你可以使用<一个href=\"http://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setSmallIcon%28int%29\"相对=nofollow> setLargeIcon 方法。

To set this icon you can use setLargeIcon method.

这篇关于创建保存图标的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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