【问题标题】:Is it possible in android to add app icon to status bar?android中是否可以将应用程序图标添加到状态栏?
【发布时间】:2012-10-25 14:35:20
【问题描述】:

是否可以在 android 中将应用程序图标添加到状态栏,类似于 wifi/蓝牙图标?我知道它可以使用状态栏通知来完成,但是当我们清除通知时它会被清除。我可以在状态栏上永久显示图标吗?

【问题讨论】:

  • 发布解决方案或您已解决问题的 sn-p

标签: android android-notifications


【解决方案1】:

要保留图标直到您将其清除,您可以执行以下操作:

 Notification notification = new Notification(R.drawable.icon, "", when_to_display);
 notification.flags |= Notification.FLAG_AUTO_CANCEL;

那么你必须清除它。还有其他标志,都在这里描述: http://developer.android.com/reference/android/app/Notification.html

【讨论】:

  • 感谢大卫的回复。我想到了。我现在使用标志 on_going 以便图标仅保留在托盘中
  • 是的,事后看来我的回答表明它确实没有回答你的问题,即标志 (AUTO_CANCEL) 绝对不是你要找的那个。
猜你喜欢
  • 2020-09-07
  • 1970-01-01
  • 2016-04-28
  • 1970-01-01
  • 2010-11-11
  • 1970-01-01
  • 1970-01-01
  • 2013-05-19
  • 2017-12-16
相关资源
最近更新 更多