如何在状态栏中执行通知而不在“通知”中显示扩展消息?窗户? (只想要图标)

发布于 2024-09-28 09:09:44 字数 82 浏览 0 评论 0原文

如何在状态栏中发出通知,但在“通知”窗口中没有展开的消息?

我的意思是,我只需要图标,仅此而已,

有办法做到这一点吗?

How can i do a notification in the status bar but without the expanded message in the "Notifications" window?

i mean, i need just the icon, nothing more

there is a way to do that?

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

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

发布评论

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

评论(1

江心雾 2024-10-05 09:09:44

引用文档

状态栏通知需要满足以下所有条件:

  • 状态栏的图标
  • 展开视图的标题和展开消息(除非您定义自定义展开视图)
  • PendingIntent,在选择通知时触发

因此,您需要在通知抽屉中有一个条目。除其他原因外,这是为了让用户知道你的图标到底是做什么用的。请记住,Android 开发的目标是让用户满意。状态栏中出现无法解释的图标不会让用户满意。

Quoting the documentation:

A status bar notification requires all of the following:

  • An icon for the status bar
  • A title and expanded message for the expanded view (unless you define a custom expanded view)
  • A PendingIntent, to be fired when the notification is selected

Hence, you will need to have an entry in the notification drawer. Among other reasons, this is so the user has some idea what the heck your icon is there for. Remember that the goal of Android development is to make users happy. Having unexplained icons in the status bar will not make the users happy.

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