Android large picture style notification with multi-line summary text

I am trying to create a notification with a large picture with a short line text marked in red, as shown below.

enter image description here

I created a large image, but my resulting text, not included in several lines, fell into one line and was cut from the end. Please help if anyone knew.

the code

NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); String title = context.getString(R.string.app_name); Bitmap remotePicture = null; Bitmap appIcon = null; // Create the style object with BigPictureStyle subclass. NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle(); notiStyle.setBigContentTitle(title); notiStyle.setSummaryText(message); try { appIcon = BitmapFactory.decodeResource(context.getResources(), icon); remotePicture = BitmapFactory.decodeStream((InputStream) new URL(image).getContent()); } catch (IOException e) { e.printStackTrace(); } // Add the big picture to the style. if(remotePicture != null) notiStyle.bigPicture(remotePicture); // This ensures that the back button follows the recommended convention for the back key. TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); // Adds the back stack for the Intent (but not the Intent itself). try { if(in.getData() == null) stackBuilder.addParentStack(Class.forName(in.getComponent().getClassName())); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Adds the Intent that starts the Activity to the top of the stack. stackBuilder.addNextIntent(in); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); Notification noti = new NotificationCompat.Builder(context) .setSmallIcon(icon) .setAutoCancel(true) .setLargeIcon(appIcon) .setContentIntent(resultPendingIntent) .setContentTitle(title) .setContentText(message) .setStyle(remotePicture == null ? null : notiStyle).build(); noti.defaults |= Notification.DEFAULT_LIGHTS; noti.defaults |= Notification.DEFAULT_VIBRATE; noti.defaults |= Notification.DEFAULT_SOUND; noti.flags |= Notification.FLAG_ONLY_ALERT_ONCE; notificationManager.notify(0, noti); 
+7
android notifications
source share

No one has answered this question yet.

See similar questions:

3
Android BigPicture custom notification with multi-line summary does not work on API 25 and API 26

or similar:

685
Android separator / line separator in layout?
641
Limit text length of EditText in Android
631
Is it possible to underline text in Android layout?
507
Android: combining text and images on Button or ImageButton
447
How to display the current Android preference value in the preferences summary?
419
Allow multi-line view in EditText in Android?
143
Android: remove notification from notification bar
5
Android Big Picture Style notification and big text style
one
How to know the image size in an Android notification?
0
Android Large Image Notification

All Articles