在不使用自定义布局的情况下在 Android 通知中隐藏时间 [英] Hide time in Android notification without using custom layout

查看:19
本文介绍了在不使用自定义布局的情况下在 Android 通知中隐藏时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标准 Android 通知的右下角是时间(例如 12:00).我可以在不使用自定义通知布局的情况下隐藏它吗?

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

推荐答案

从 API Level 17 开始,你可以使用 setShowWhen(false)

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

public Notification.Builder setShowWhen (boolean show)

public Notification.Builder setShowWhen (boolean show)

API level 17新增控制时间戳是否用setWhen设置显示在内容视图中.

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)

这篇关于在不使用自定义布局的情况下在 Android 通知中隐藏时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆