Is there a way to add a badge to an application icon in Android?

转载 2012年03月21日 12:58:48

问:

On the iPhone, you can add a numbered badge to the application icon. On BlackBerry, I've successfully painted an image onto the application's icon while in the program. I want to do this for Android as well. I don't want to use the notification bar, as it's not something that needs to be notified instantly. Instead, I just want the user to be able to see how many new messages are in the application just by looking at the application icon.

Thanks in advance,

groomsy



答:

Unfortunately, Android does not allow changing of the application icon because it's sealed in the APK once the program is compiled. There is no way to programmatically change it to a 'drawable'.

You may achieve your goal by using a widget instead of an icon. Widgets are highly customisable and can do what you want.

There's a short discussion about the difference between iPhone icon notification and using widgets here:

http://www.cnet.com/8301-19736_1-10278814-251.html

As you'll notice, there is virtually no difference between using a widget or an icon, since they can be the same size and look the same.



Is-there-any-way-to-prevent-an-android-app-from-being-removed

Is-there-any-way-to-prevent-an-android-app-from-being-removed

Is there a limit to the number of columns in an HBase row?

Quora上一个哥们提出下面这个问题,之前其实读过的不过没怎么在意comments,而且自己还亲自测试了一下这个问题确定当一个row很大的时候不会发生拆分的。今天又看了一遍,其实这里面已经包含了很多信...
  • macyang
  • macyang
  • 2011年03月04日 09:28
  • 1058

AlertDialog显示错误 Unable to add window token null is not for an application

在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码   08-07 21:26:43.506: ERROR/A...

AlertDialog显示错误 Unable to add window token null is not for an application

在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码   08-07 21:26:43.506: ERROR/Android...
  • hwuyule
  • hwuyule
  • 2013年05月15日 11:54
  • 415

AlertDialog:Unable to add window -- token null is not for an application

在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码   08-07 21:26:43.506: ERROR/Android...

Unable to add window -- token null is not for an application错误的解决方法

 今天自己做一个小程序,给windowManager添加一个view的时候,一直报一个错误: Caused by: android.view.WindowManager$BadTokenExc...
  • killcwd
  • killcwd
  • 2014年06月08日 09:34
  • 489

AlertDialog显示错误 Unable to add window token null is not for an application

来源:ITEYE 作者:Trinea 在listView的onItemClick函数中显示一个AlertDialog,出现如下错误 Xml代码  ...

Unable to add window -- token null is not for an application,普通应用程序悬浮窗口(TYPE_APPLICATION)

今天在做悬浮窗口的时候遇到了一个bug。本来是做WindowManager.LayoutParams.type = TYPE_PHONE,在所有应用程序上的悬浮窗口,后面改成只能在本Activity中...

Attempting to badge the application icon but haven't received permiss

(1)原因 一切都是iOS8捣的鬼。您如果把模拟器换成iOS7.1或者更早的,就不会有这个问题。而现在在iOS8中要实现badge、alert和sound等都需要用户同意才能,因为这些都算做No...

I have updated Android SDK to rev. 22 yesterday and there is no apkbuilder in tools

转:http://stackoverflow.com/questions/16620655/i-have-updated-android-sdk-to-rev-22-yesterday-and-the...
  • javalfx
  • javalfx
  • 2015年10月14日 21:58
  • 836
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Is there a way to add a badge to an application icon in Android?
举报原因:
原因补充:

(最多只允许输入30个字)