android - 如何在android 2.2通知中添加换行符

标签 android

我想在通知的长文本中包含换行符。\n 不起作用。

notification.setLatestEventInfo(context, title, message+"\r\n"+"test",intent);

android2.2通知中的换行符代码是什么?

谢谢

最佳答案

我认为您可能必须创建一个带有两个 TextView 的自定义通知布局,每个 TextView 对应一行。

这是通知的官方教程,但我不确定其中有多少适用于 2.2。 http://developer.android.com/guide/topics/ui/notifiers/notifications.html

以下链接可能也有用: Custom notification layouts and text colors

关于android - 如何在android 2.2通知中添加换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13862281/

相关文章:

android - 解析 html 数据时收到 JSON 异常 "Unterminated Array"

android - 如何将线程结果保存在数据库中

android - 有什么方法可以打开应用程序的电池使用情况( Intent )?

android - CampaignTrackingService 服务有无法启动的风险

安卓。火力地堡 : Could not parse the Android Application module

android 不同形式的layout_toLeftOf 和layout_toStartOf?

android - 设置包含布局的子元素的属性

javascript - 运行 react native Android 应用程序时出错 - BatchedBridge

android - 使用 Facebook 身份验证登录问题

android - 如何防止Android SpeechRecognizer被破坏后发出声音?