You have to use custom layouts for notification to override default configurations.
- Build a basic notification with NotificationCompat.Builder.
- Call setStyle(), passing it an instance of NotificationCompat.DecoratedMediaCustomViewStyle.
- Inflate your custom layout as an instance of RemoteViews.
- Call setCustomContentView() to set the layout for the collapsed notification.
Optionally, also call setCustomBigContentView() to set a different layout for the expanded notification.
Example:
// Get the layouts to use in the custom notification
RemoteViews notificationLayout = new RemoteViews(getPackageName(),
R.layout.notification_small);
RemoteViews notificationLayoutExpanded = new RemoteViews(getPackageName(),
R.layout.notification_large);
// Apply the layouts to the notification
Notification customNotification = new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setCustomBigContentView(notificationLayoutExpanded)
.build();
Follow this for detailed info