'Create fully notifcation android 12

I want to custom notification like image. In android 12, my custom notification not is not fit the notification area width. How can I fix it? Here is my notification:

    val builder = NotificationCompat.Builder(this, channelId)
        .setSmallIcon(R.drawable.img_app_logo)
        .setCustomContentView(remoteViews)
        .setCustomBigContentView(remoteViews)
        .setCustomHeadsUpContentView(remoteViews)
        .setPriority(NotificationCompat.PRIORITY_HIGH)
        .setAutoCancel(true)
        .addAction(optimizeAction)
    cancelAction?.let {
        builder.addAction(it)
    }
    notificationManager.notify(notificationId, builder.build())

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source