如何在应用启动器图标中显示通知计数 [英] How to display count of notifications in app launcher icon

查看:39
本文介绍了如何在应用启动器图标中显示通知计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

三星 Galaxy Note 2 安卓版本 4.1.2

samsung galaxy note 2 android version 4.1.2

我知道之前有人问过这个问题,无法回复

I know that this question was asked before and the reply was not possible

如何在应用程序启动器图标上显示气球计数器安卓

How to display balloon counter over application launcher icon on android

尽管如此,昨天我更新了 facebook 应用程序,它开始显示未读消息的私人消息计数器.为什么 facebook 应用程序可以,而我的应用程序不能这样做?

Nevertheless yesterday I updated the facebook app and it started to show a counter of unread messages private messages. How come facebook app can and I cant do so for my app?

三星 Galaxy Note 2 安卓版本 4.1.2

samsung galaxy note 2 android version 4.1.2

推荐答案

Android(没有自定义启动器和触摸界面的vanilla"android)不允许更改应用程序图标,因为它是密封的一旦程序被编译,在 .apk 中.无法使用标准 API 以编程方式将其更改为可绘制".您可以通过使用小部件而不是图标来实现您的目标.小部件是可定制的.请阅读:http://www.cnet.com/8301-19736_1-10278814-251.html 和这个 http://developer.android.com/guide/topics/appwidgets/index.html.另请参阅:https://github.com/jgilfelt/android-viewbadger.它可以帮助你.

至于徽章编号.正如我之前所说 - 没有标准的方法可以做到这一点.但我们都知道 Android 是一个开放的操作系统,我们可以用它做任何我们想做的事情,所以添加徽章编号的唯一方法 - 要么使用一些 3 方应用程序或自定义启动器,要么前端触摸接口:Samsung TouchWiz 或 Sony Xperia 的接口.其他答案使用此功能,您可以在 stackoverflow 上搜索,例如此处.但我会再重复一遍:没有标准 API 用于此,我想说这是一种糟糕做法.应用程序的图标通知徽章是一种 iOS 模式,无论如何都不应该在 Android 应用程序中使用.在 Android 中有一个用于这些目的的状态栏通知:http://developer.android.com/guide/topics/ui/notifiers/notifications.html因此,如果 Facebook 或其他人使用它 - 这不是我们应该考虑的常见模式或趋势.但是,如果您仍然坚持并且不想使用主屏幕小部件,那么请看这里,请:

Facebook 如何在Android 中的应用图标?

如您所见,这不是真正的 Facebook 应用程序,而是 TouchWiz.在原版安卓中,这可以通过 Nova Launcher http 来实现://forums.androidcentral.com/android-applications/199709-how-guide-global-badge-notifications.html因此,如果您会在某处看到图标徽章,请确保它是第 3 方启动器或触摸界面(前端包装器).Google 可能会在某个时候将此功能添加到标准的 Android API 中.

Android ("vanilla" android without custom launchers and touch interfaces) does not allow changing of the application icon, because it is sealed in the .apk tightly once the program is compiled. There is no way to change it to a 'drawable' programmatically using standard APIs. You may achieve your goal by using a widget instead of an icon. Widgets are customisable. Please read this :http://www.cnet.com/8301-19736_1-10278814-251.html and this http://developer.android.com/guide/topics/appwidgets/index.html. Also look here: https://github.com/jgilfelt/android-viewbadger. It can help you.

As for badge numbers. As I said before - there is no standard way for doing this. But we all know that Android is an open operating system and we can do everything we want with it, so the only way to add a badge number - is either to use some 3-rd party apps or custom launchers, or front-end touch interfaces: Samsung TouchWiz or Sony Xperia's interface. Other answers use this capabilities and you can search for this on stackoverflow, e.g. here. But I will repeat one more time: there is no standard API for this and I want to say it is a bad practice. App's icon notification badge is an iOS pattern and it should not be used in Android apps anyway. In Andrioid there is a status bar notifications for these purposes:http://developer.android.com/guide/topics/ui/notifiers/notifications.html So, if Facebook or someone other use this - it is not a common pattern or trend we should consider. But if you insist anyway and don't want to use home screen widgets then look here, please:

How does Facebook add badge numbers on app icon in Android?

As you see this is not an actual Facebook app it's TouchWiz. In vanilla android this can be achieved with Nova Launcher http://forums.androidcentral.com/android-applications/199709-how-guide-global-badge-notifications.html So if you will see icon badges somewhere, be sure it is either a 3-rd party launcher or touch interface (frontend wrapper). May be sometime Google will add this capability to the standard Android API.

这篇关于如何在应用启动器图标中显示通知计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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