【问题标题】:Android - Notification BigPictureStyleAndroid - 通知 BigPictureStyle
【发布时间】:2016-05-18 20:01:25
【问题描述】:

我想显示这样的通知

但我越来越喜欢这个

我正在使用代码

final Notification notifyDetails = new NotificationCompat.Builder(context)
                                .setContentTitle(mTitle)
                                .setContentText(mDesc)
                                .setSmallIcon(R.mipmap.ic_launcher)
                                .setTicker(mDesc)
                                .setStyle(new NotificationCompat.BigPictureStyle()
                                        .bigPicture(myBitmap)
                                        .setSummaryText(mDesc))
                                .setContentIntent(nIntent)
                                .addAction(R.drawable.share, "Share", nIntent)
                                .build();
                        mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);

如何显示我的通知?我google了,没解决。请任何人为此工作,请分享您的想法。

提前非常感谢

【问题讨论】:

  • 你想达到什么不同?
  • 内容文本应该在底部,分享动作应该在顶部,背景白色不应该显示......
  • stackoverflow.com/a/16168704/1979882 阅读此内容。你必须使用自定义视图

标签: android notifications android-notifications


【解决方案1】:

为此,您将需要用于通知的自定义 UI。 有关详细信息,请参阅下面的链接。

Custom Notification

【讨论】:

    【解决方案2】:

    我希望它会起作用

    Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.image);
            NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
                    .setLargeIcon(bm) 
                    .setContentTitle("Event tracker")
                    .setContentText("Events received")
    

    请注意大图标必须是位图

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-23
      • 1970-01-01
      • 2019-09-12
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多