问题描述
我正在使用兼容性库实现Android丰富的通知,因此我的所有通知都是使用android.support.v4.app.NotificationCompat.Builder
I'm being implementing Android rich notifications using the compatibility library, so all my notifications are being built using android.support.v4.app.NotificationCompat.Builder
我正在使用的代码如下:
the code I'm using is the following:
// Base notification
NotificationCompat.Builder b = new NotificationCompat.Builder(context);
b.setSmallIcon(R.drawable.ic_actionbar);
b.setContentTitle(title);
b.setContentText(Html.fromHtml(msg));
b.setTicker(title);
b.setWhen(System.currentTimeMillis());
b.setDeleteIntent(getDismissNotificationsPendingIntent(quantity));
b.setLargeIcon(Picasso.with(context).load(iconUrl).get());
// BigPictureStyle
NotificationCompat.BigPictureStyle s = new NotificationCompat.BigPictureStyle();
if (expandedIconUrl != null) {
s.bigLargeIcon(Picasso.with(context).load(expandedIconUrl).get());
} else if (expandedIconResId > 0) {
s.bigLargeIcon(BitmapFactory.decodeResource(context.getResources(), expandedIconResId));
}
s.bigPicture(Picasso.with(context).load(bigImageUrl).get());
b.setStyle(s);
b.setContentIntent( // some intent
b.addAction(R.drawable.ic_notification_ // some action
Notification n = b.build();
// and go ahead to show it
如果显示的图像不兼容,则有一些额外的基本不加载任何图像的操作,因此我们无缘无故地使用内存,但这是基础,我希望它与右侧的通知类似下图
There's a bit of extra basically not loading any images if showing images is not compatible, so we don't use memory for no reason, but that's the base and I'm expecting something similar to the notification to the right of the following image
问题在于该消息(在示例触摸以查看您的屏幕截图."上)显示了该通知是何时收缩的,但是当该通知展开时,该消息却消失了.
the problem is that the message (on the example "Touch to view your screenshot.") shows when the notification is contracted, but when the notification is expanded the message disappears.
我有没有忘记调用的setMessage()
方法?这是NotificationCompat
的错误吗?任何人都可以在这里提供一些见识吗?
Is there any setMessage()
method I am forgetting to call? Is that a bug with NotificationCompat
? Can anyone give some insight here?
推荐答案
是的! NotificationCompat.BigPictureStyle setSummaryText
这篇关于Android通知BigPictureStyle消失的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!