如何制作YouTube样式通知



我需要自定义YouTube样式的通知。但是,我找不到任何具有样式的应用程序。

它仅使用youtube?

请您的建议。

Notification.Builder(context)
                .setContentTitle(" ")
                .setContentText(description)
                .setSmallIcon(R.drawable.notification_icon)
                .setColor(context.getColor(R.color.notification_default_color))
                .setContentIntent(pendingIntent)
                .setAutoCancel(true)
                .setStyle(Notification.DecoratedCustomViewStyle())
                .setGroup(notificationType.summaryGroupKey)
                .setActions(*actions)
                .setCustomContentView(smallView)
                .setCustomBigContentView(expandedView)

我找到了一种方法。

这是定制的远程观察和bigpicturestyle的组合。

val builder = Notification.Builder(context)
                .setContentTitle(title)
                .setContentText(description)
                .setSmallIcon(R.drawable.notification_icon)
                .setColor(context.getColor(R.color.notification_default_color))
                .setContentIntent(pendingIntent)
                .setAutoCancel(true)
                .setStyle(Notification.BigPictureStyle().bigPicture(bitmap))
                .setActions(*actions)
                .setCustomContentView(smallView)

自定义的远程视图具有自己的UI组件,而不是应用程序图标,应用程序等等。

我可以使其与原始UI相似。

这是一些技巧。

最新更新