Android Wear - 通知标题格式

标签 android android-notifications wear-os

我试图让我的 Android Wear 通知的标题显示超过 2 行(或更多行)而不是总是 1 行。Here是我想要的例子,但是 here这就是它现在正在做的。我正在使用

NotificationCompat.Builder.setContentTitle(CharSequence title)

记录在案here .我试过插入换行符和/或回车符,它适用于通知中的文本,但不适用于标题。我需要某种方式让标题自动换行,或者某种方式让它识别换行符。 谢谢

最佳答案

我认为大文本是您想要的。

Notification notif = new Notification.Builder(mContext)
     .setContentTitle("New mail from " + sender.toString())
     .setContentText(subject)
     .setSmallIcon(R.drawable.new_mail)
     .setLargeIcon(aBitmap)
     .setStyle(new Notification.BigTextStyle()
         .setBigContentTitle(aVeryLongString))
     .build();

关于Android Wear - 通知标题格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25123225/

相关文章:

android - 如何在大于屏幕尺寸的 Canvas 上绘制并能够在 android 中水平和垂直滚动/平移?

java - 在 Cloud Firestore 上创建或删除字段时如何获得通知

安卓工作室 : Error while waiting for device: The emulator process for AVD ____ has terminated

java - Android toast 更改偏好设置

Android Wear 通知在更新时防止图标闪烁

android - 如何停止在 Android 上以编程方式播放通知声音

android - 通知在 Ginger Bread 中不显示,但在 JellyBean 中有效

android - Flutter 应用程序,每天在 x 时间检查,看看我是否需要向用户发送本地通知

android - 无法在 wearos 蓝牙上发送 HTTP 请求

android - 在 Android Wear 2.0 上尝试 Firebase 身份验证(使用 Google)显示 "InternalFirebaseAuth.FIREBASE_AUTH_API is not available on this device"