简体   繁体   中英

How to show icon in the notification text Area in android

I have a simple query , whose answer i do not seem to get from anywhere. I have a notification like below

    NotificationCompat.Builder mBuilder= new NotificationCompat.Builder(baseContext).setLargeIcon(large_icon)
                .setSmallIcon(R.drawable.message_received_small_icon)
                .setContentIntent(pendingIntent)
                .setAutoCancel(true)
                .setSound(soundUri);
mBuilder.setContentText(_summaryText);

        notification = mBuilder.build();

I know setContentText will set message say M, the user want to show on the notification. My question is is there any way i can show an icon with the message M. I want to show an icon to left of message . Is that possible with default notification. I have been stuck at it for a long time.

I can create a custom remoteview for displaying the icon . But As android versions are updating , each version has a different style of notification . So if i use custom layout for notification , then i will need to create custom view for all android versions, which i want as a last option.

Please help if it is possible with currently available styles.

in your notification builder set large icon will set the icon in left of your notification message.

  mBuilder.setLargeIcon(BitmapFactory.decodeResource(context.getResources(),
                    R.mipmap.ic_launcher))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM