Java Android暗模式反转自定义通知';颜色-有时
我在android中创建了一个持久性通知,显示用户的学校时间表。 美丽的颜色-理论上: 不幸的是,如果我的设备(android 10)的暗模式被启用,颜色就会反转: 在模拟器中,颜色总是正确的 我尝试自己反转颜色,以在黑暗模式下获得正确的颜色,但当通知变为“lighty”时,颜色不再反转Java Android暗模式反转自定义通知';颜色-有时,java,android,notifications,darkmode,Java,Android,Notifications,Darkmode,我在android中创建了一个持久性通知,显示用户的学校时间表。 美丽的颜色-理论上: 不幸的是,如果我的设备(android 10)的暗模式被启用,颜色就会反转: 在模拟器中,颜色总是正确的 我尝试自己反转颜色,以在黑暗模式下获得正确的颜色,但当通知变为“lighty”时,颜色不再反转 有点奇怪。setDefaultNightMode()对通知的颜色没有影响 Notification notification = new NotificationCompat.Builder(contex
有点奇怪。setDefaultNightMode()对通知的颜色没有影响
Notification notification = new NotificationCompat.Builder(context, "schedule").setContentIntent(pendingIntent)
.setSortKey("1")
.setCategory(Notification.CATEGORY_ALARM)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setSmallIcon(R.drawable.ic_stat_name)
.setOngoing(true)
.setSound(null)
.setColor(Color.parseColor(profile.primary))
.setShowWhen(false)
.setWhen(System.currentTimeMillis() + 25 * 60 * 60 * 1000)
.setVibrate(new long[]{0L})
.setCustomContentView(DayView.getRemoteViews(context, profile))
.setCustomBigContentView(WeekView.getRemoteViews(context, profile))
.setPriority(NotificationCompat.PRIORITY_MAX).build();
notification.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT | Notification.FLAG_ONLY_ALERT_ONCE;
(android.app.NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE).notify(0, notification);