首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >安卓notfication消失的文本

安卓notfication消失的文本
EN

Stack Overflow用户
提问于 2013-11-01 01:09:32
回答 1查看 10K关注 0票数 19

我正在使用兼容性库实现安卓丰富的通知,所以我所有的通知都是使用android.support.v4.app.NotificationCompat.Builder构建的

我使用的代码如下:

  // 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

如果显示图像不兼容,会有一点额外的,基本上不会加载任何图像,所以我们不会无缘无故地使用内存,但这是基础,我期待类似于下面图像右侧的通知

问题是该消息(在示例“触摸查看屏幕截图”上)。显示收缩通知的时间,但在展开通知时消息将消失。

有没有我忘了调用的setMessage()方法?这是NotificationCompat的bug吗?有人能在这里给出一些见解吗?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19712706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档