![]() These styles adapt to the color variations So you should always apply support library styles such asįor the title in your custom layout. setStyle(new NotificationCompat.DecoratedCustomViewStyle())īeware that the background color for the notification can vary across differentĭevices and versions. Notification customNotification = new NotificationCompat.Builder(context, CHANNEL_ID) RemoteViews notificationLayoutExpanded = new RemoteViews(getPackageName(), R.layout.notification_large) ![]() RemoteViews notificationLayout = new RemoteViews(getPackageName(), R.layout.notification_small) setCustomBigContentView(notificationLayoutExpanded) setStyle(NotificationCompat.DecoratedCustomViewStyle()) setSmallIcon(R.drawable.notification_icon) Val customNotification = NotificationCompat.Builder(context, CHANNEL_ID) Val notificationLayoutExpanded = RemoteViews(packageName, R.layout.notification_large) ![]() Val notificationLayout = RemoteViews(packageName, R.layout.notification_small) Get the layouts to use in the custom notification NotificationCompat.DecoratedMediaCustomViewStyle Note: If you're creating a customized notification for media playbackĬontrols, follow these same recommendations but use the Optionally, also call setCustomBigContentView() to set a different layout for the expanded SetCustomContentView() to set the layout for the collapsed notification.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |