Java android应用程序如何显示像这样的自定义通知?
我正在尝试创建一个android应用程序,显示像这样的永久通知 通知如何拥有所有这些UI和图像?以下哪种类型的通知允许此操作:Java android应用程序如何显示像这样的自定义通知?,java,android,kotlin,notifications,Java,Android,Kotlin,Notifications,我正在尝试创建一个android应用程序,显示像这样的永久通知 通知如何拥有所有这些UI和图像?以下哪种类型的通知允许此操作: 这回答了你的问题吗? // Get the layouts to use in the custom notification val notificationLayout = RemoteViews(packageName, R.layout.notification_small) val notificationLayoutExpanded = RemoteVie
这回答了你的问题吗?
// Get the layouts to use in the custom notification
val notificationLayout = RemoteViews(packageName, R.layout.notification_small)
val notificationLayoutExpanded = RemoteViews(packageName, R.layout.notification_large)
// Apply the layouts to the notification
val customNotification = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setStyle(NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setCustomBigContentView(notificationLayoutExpanded)
.build()