Custom notification layout gives unnecessary margin

岁酱吖の 提交于 2021-02-10 03:04:32

问题


I am creating a custom notification layout for my application.

NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
            .setSmallIcon(R.drawable.ic_notification_icon)
            .setPriority(NotificationCompat.PRIORITY_DEFAULT)
            .setCustomContentView(notificationLayoutCollapsed)
            .setOngoing(playing)
            .setCustomBigContentView(notificationLayoutExpanded)
            .setStyle(new NotificationCompat.DecoratedCustomViewStyle())
            .setContentIntent(pendingIntent);



My notification layout does not have internal padding or margins yet there it shows margins for the notification (Thick white border around blue notification).

Please suggest a solution to this issue.

----ANSWER-----

Culprit is this following line

.setStyle(new NotificationCompat.DecoratedCustomViewStyle())

DecoratedCustomViewStyle gives the notification a border

来源:https://stackoverflow.com/questions/57028419/custom-notification-layout-gives-unnecessary-margin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!