【问题标题】:Displaying text in Android Status Bar在 Android 状态栏中显示文本
【发布时间】:2018-02-22 11:00:26
【问题描述】:

我正在尝试在显示时间的同时在 Android Nougat 的状态栏中显示文本。我可以使用NotificationCompat.Builder 显示图标,但不能显示文本。如何进行?

【问题讨论】:

  • 据我所知,Lollipop 的状态栏中没有显示文本。这曾经可以通过 setTicker 方法实现。
  • 是的。我尝试了setTicker 方法,但没有成功。但是,有一些应用程序,如 Internet Speed Meter Lite,在 Android N 中显示文本。我想知道如何?
  • 你找到这个答案了吗:stackoverflow.com/a/45392031/5272951 ?
  • @EJusius 我找到了它并试图合并它。没用。

标签: android


【解决方案1】:

如果你使用NotificationCompat.Builder,你可以在那里设置文本

NotificationCompat.Builder mBuilder =
    new NotificationCompat.Builder(this)
    .setSmallIcon(R.drawable.notification_icon)
    .setContentTitle("My notification")
    .setContentText("Hello World!")

您也可以联系this

【讨论】:

    【解决方案2】:

    通过将String转换为Bitmap解决了这个问题。从here得到想法

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-04
      • 1970-01-01
      • 2019-10-29
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      • 1970-01-01
      • 2015-12-18
      相关资源
      最近更新 更多