我怎样才能做到在状态栏上的通知,而不在&QUOT展开的消息;通知"窗口? (只想要的图标)通知、图标、栏上、状态

2023-09-07 14:00:27 作者:暖心好不好

我怎样才能做一个通知状态栏,但没有在通知窗口中展开的消息?

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?

推荐答案

的引用文档:

一个状态栏通知,要求所有如下:

A status bar notification requires all of the following:   状态栏图标   标题和扩展的消息展开的视图(除非您定义自定义扩展视图)   系统PendingIntent,当选择该通知被解雇    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

因此​​,你需要在通知抽屉里的条目。除其他原因外,这是为了让用户有一定的想法到底你的图标是什么在那里。请记住,Android开发的目标是使用户满意。有不明原因的图标状态栏不会让用户感到满意。

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.