制作动态启动器图标

发布于 2025-01-01 01:32:03 字数 458 浏览 4 评论 0原文

我想创建一个类似于 Android 中本机消息应用程序的启动器图标。该应用程序的图标有一个图像,但也有一个动态变化的数字(某种与未读消息数量相对应的计数器)。此外,这个图标不是一个小部件,因为它是应用程序抽屉中存在的实际图标。

有人可以向我解释一下我该如何实现这一目标吗?我找到了一些解决方案,其中包含一个尺寸设置为 1x1 的小部件,但我不希望人们将快捷方式添加到我的应用程序作为小部件。如果可能的话,我想以某种编程方式操作启动器图标。

提前致谢!

笔记: 很久以前就有一个和我类似的问题。然而,从那时起 Android API 经历了很多变化,旧的答案可能适用也可能不适用 - 因此需要一个新问题。 (链接

I want to create a launcher icon similar to the native Messaging application in Android. The icon of this app has an image but also have a dynamically changing number(a counter of some sort that corresponds to the number of unread messages). Also this icon it is not an widget, as it's an actual icon that's present in the application drawer.

Can someone explain to me how I can go about to achieve this? I found some solution that includes a widget with the dimensions set to 1x1 but I do not want people to add shortcuts to my app as widget. If possible, I'd want to manipulate the launcher icon in some programmatical way.

Thanks in advance!

Note:
There is a question similar to mine asked a long time ago. However, seeing that the Android API has gone through a lot of changes since then, the older answers may or may not be applicable - hence the need for a new question. (link)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

桜花祭 2025-01-08 01:32:03

有人可以解释一下我该怎么做吗?

您不能,除非使用自己的启动器创建自己的主屏幕。

Can someone explain me how can I do this ?

You can't, short of creating your own home screen with your own launcher.

梦途 2025-01-08 01:32:03

您无法制作动态启动器图标

或者,您可以设计一个类似于您的图标的主屏幕小部件,它可以自行更新。

这里是有关如何制作首页的教程屏幕小部件

如果您需要在 Android 设备的 Menu 上获取该内容,我认为 @CommonsWare 所说的很有必要。

You cannot make an Dynamic launcher icon.

Alternatively, you can design a Home Screen Widget similar to your icon which can update itself.

Here's a tutorial on how to make a Home Screen Widget.

If you need to get that on the Menu of an Android Device, I think it is necessary what @CommonsWare said.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文