Android Notification.BigTextStyle行为 [英] Android Notification.BigTextStyle behavior

查看:282
本文介绍了Android Notification.BigTextStyle行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用

Notification.setContextText("Teaser text.  Read more...");
Notification.setStyle(new Notification.BigTextStyle().bigText("full text ..."));

  • 当通知出现在列表的顶部(或是唯一的通知)时,我会看到整个全文"都按需包装在多行上.
  • 当此通知上方还有其他通知时,我会看到"Teaer文本.了解更多...".
  • 如果我忽略了上面的BigTextStyle位,只是发出了setContentText("full text..."),则全文将部分显示并且不会环绕.
    • When the notification appears at the top of the list (or is the only notification) I see the whole of "full text" wrapped onto multiple lines as required.
    • When there are other notifications above this one I see "Teaser text. Read more...".
    • If I leave out the BigTextStyle bit above and simply issue setContentText("full text...") the full text appears partially and does not wrap around.
    • 这是预期的行为吗?是否可以以某种方式修改它以使其始终(即,当通知不在列表顶部时)显示大文本-还是让ContentText换行?对于此方面的帮助和提示,我非常有义务.

      Is this the expected behavior? Can it somehow be modified so as to always - i.e. when the notification is not at the top of the list - show the big text - or get ContentText to wrap? I'd be most obliged for any help and tips on this.

      推荐答案

      您所看到的是正确的.默认情况下,仅最顶部的通知会展开,但是用户始终可以展开任何通知(通过两根手指向下滑动或一根手指按住并向下滑动).无法以编程方式始终使通知扩展或以编程方式扩展通知.

      What you are seeing is correct. Only the topmost notification is expanded by default, however the user can always expand any notification (through a two finger swipe down or one finger hold and swipe down). There's no way to programmatically always make your notification expanded or programmatically expand it.

      这篇关于Android Notification.BigTextStyle行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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