拡張可能な通知を実装しようとしましたが、そのためにInboxStyleを使用しました。
ドキュメントからの次の画像に基づく:
テキストのスタイルを設定できるはずです。この場合、「GooglePlay」を太字にします。
InboxStyleにはaddLine()
、CharSequenceを渡すことができる場所しかありません。いくつかのhtmlフォーマットを試してHtml.fromHtml()
使用しましたが、成功しませんでした。
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
inboxStyle.setBigContentTitle("title");
inboxStyle.setSummaryText("summarytext");
// fetch push messages
synchronized (mPushMessages) {
HashMap<String, PushMessage> messages = mPushMessages.get(key);
if (messages != null) {
for (Entry<String, PushMessage> msg : messages.entrySet()) {
inboxStyle.addLine(Html.fromHtml("at least <b>one word</b> should be bold!");
}
builder.setStyle(inboxStyle);
builder.setNumber(messages.size());
}
}
これについて何か考えはありますか?