我正在掌握 Kotlin 协程并试图弄清楚
1-什么是热流和冷流?
2-它们之间的主要区别是什么?
3-什么时候使用每一个?
我想制作一个自定义通知视图,其中的内容会定期更新。自定义视图可能包含操作按钮。在android文档中,我们可以使用XML布局文档创建自定义视图:https://developer.android.com/training/notify-user/custom-notification
// 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()
Run Code Online (Sandbox Code Playgroud)
那么我们可以使用 jetpack compose 制作自己的自定义通知视图吗?
android android-layout android-notifications android-view android-jetpack-compose