目前,我已经实施了多行通知 NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this.getApplicationContext()) .setContentIntent(contentIntent) .setSmallIcon(R.drawable.ic_notification) .setContentTitle(contentTitl
          NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this.getApplicationContext())
            .setContentIntent(contentIntent)
            .setSmallIcon(R.drawable.ic_notification)
            .setContentTitle(contentTitle)
            .setDefaults(Notification.DEFAULT_SOUND)
            .setTicker(ticker)
            .setContentText(contentText);
    // Need BIG view?
    if (size > 1) {
        NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
        // Sets a title for the Inbox style big view
        inboxStyle.setBigContentTitle(contentTitle);
        for (String notificationMessage : notificationMessages) {
            inboxStyle.addLine(notificationMessage);
        }
        mBuilder.setStyle(inboxStyle);
    }
    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build()); 
 但是,这并不是我想要的.当我看看GMail的实现时,我意识到他们左手边的文字(严成澈)的每一行,都在突出.
我想知道,实现这种效果的技术是什么?我想突出我的股票名称.
代码inboxStyle.addLine(notificationMessage);接受CharSequence作为参数,而不是String因此,您可以通过应用UnderlineSpan轻松实现所需的效果
遵循参考链接:
https://developer.android.com/reference/android/text/style/UnderlineSpan.html
How to set underline text on textview?
快速编辑:
我只是意识到OP提到的亮点而不是下划线但答案仍然是相同的,OP可以选择自定义文本的几种类型的CharacterSpan:
https://developer.android.com/reference/android/text/style/CharacterStyle.html
