androidpush-notification

How to create a Custom Notification Layout in android?


how to show full content in notification at frist time in android with using notification style or need to go for custom layout??


Solution

  • I used BigTextStyle() to add highlighted text in notification.

    return new NotificationCompat.Builder(context)
           .setSmallIcon(R.drawable.ic_mono)
           .setContentTitle(title)
           .setContentText(message)
           .setLargeIcon(icon)
           .setColor(ContextCompat.getColor(context, R.color.notification_color))
           .setStyle(new NotificationCompat.BigTextStyle().bigText(title))
           .setStyle(new NotificationCompat.BigTextStyle().bigText(message).setSummaryText("#hashtag"))
           .setShowWhen(true)
           .setAutoCancel(true);