Android - 通知 BigPictureStyle
Android - Notification BigPictureStyle
我想这样显示通知
但我越来越像这样
我正在使用代码
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 它,我没有得到解决方案。请任何从事此工作的人,请分享您的想法。
非常感谢
为此,您需要自定义 UI 来通知。
详情请参考下面link
希望有用
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.image);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(bm)
.setContentTitle("Event tracker")
.setContentText("Events received")
请注意大图标必须是位图
我想这样显示通知
但我越来越像这样
我正在使用代码
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 它,我没有得到解决方案。请任何从事此工作的人,请分享您的想法。
非常感谢
为此,您需要自定义 UI 来通知。 详情请参考下面link
希望有用
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.image);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setLargeIcon(bm)
.setContentTitle("Event tracker")
.setContentText("Events received")
请注意大图标必须是位图