Hide time in Android notification without using custom layout

前端 未结 3 2126
隐瞒了意图╮
隐瞒了意图╮ 2020-12-09 02:25

In the bottom right corner of a standard Android notification is time (eg 12:00). Can I hide it without using custom notification layout?

相关标签:
3条回答
  • 2020-12-09 02:39

    For API level 17 and onward, the above accepted answer by Erwan is correct.

    For historical purposes, the answer below remains

    It is possible to do that.

    Try setting when to 0. For the few notifications that don't do that, it looks like thats what they do.

    Here's the general API reference.

    Here's a link to the ADB notification and search for private void updateAdbNotification()...

    0 讨论(0)
  • 2020-12-09 02:44

    For API level 17 and onward, mBuilder.setShowWhen(boolen);

    1.Use Hide Notification Time

    mBuilder.setShowWhen(false);

    2.Use Show Notification Time

    mBuilder.setShowWhen(true);

    0 讨论(0)
  • 2020-12-09 02:59

    From API Level 17 onwards, you can use setShowWhen(false)

    public Notification.Builder setShowWhen (boolean show)

    Added in API level 17 Control whether the timestamp set with setWhen is shown in the content view.

    http://developer.android.com/reference/android/app/Notification.Builder.html#setShowWhen(boolean)

    0 讨论(0)
提交回复
热议问题