6

Android Big Picture Style Notification

Limon
  • 61
  • 1
  • 1
  • 2

3 Answers3

20

Sizes for notification images for BigPictureStyle

Minimum - 512x256

Balanced - 1024x512

Maximum - 2048x1024

Got from this answer https://stackoverflow.com/a/33391039/5783417

Note : In smaller devices (800x480), there is still a center crop occurring

Community
  • 1
  • 1
Atul Vasudev A
  • 463
  • 3
  • 22
0

Try this code

 Notification notif = new Notification.Builder(mContext)
     .setContentTitle("New photo from " + sender.toString())
     .setContentText(subject)
     .setSmallIcon(R.drawable.new_post)
     .setLargeIcon(aBitmap)
     .setStyle(new Notification.BigPictureStyle()
         .bigPicture(aBigBitmap))
     .build();
Surya Prakash Kushawah
  • 3,185
  • 1
  • 22
  • 42
-1

To have a notification appear in an expanded view, first create a NotificationCompat.Builder object with the normal view options you want. Next, call Builder.setStyle() with an expanded layout object as its argument.

Remember that expanded notifications are not available on platforms prior to Android 4.1. To learn how to handle notifications for Android 4.1 and for earlier platforms, read the section Handling compatibility.

For example, the following code snippet demonstrates how to alter the notification created in the previous snippet to use the expanded layout:

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("Event tracker")
.setContentText("Events received")
NotificationCompat.InboxStyle inboxStyle =
    new NotificationCompat.InboxStyle();
String[] events = new String[6];
// Sets a title for the Inbox in expanded layout
inboxStyle.setBigContentTitle("Event tracker details:");
...
// Moves events into the expanded layout
for (int i=0; i < events.length; i++) {
  inboxStyle.addLine(events[i]);
}
// Moves the expanded layout object into the notification object.
mBuilder.setStyle(inboxStyle);
...
// Issue the notification here.

You can also refer to this link, Applying an expanded layout to a notification

Abhi
  • 2,115
  • 2
  • 18
  • 29