Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android暗模式反转自定义通知';颜色-有时_Java_Android_Notifications_Darkmode - Fatal编程技术网

Java Android暗模式反转自定义通知';颜色-有时

Java Android暗模式反转自定义通知';颜色-有时,java,android,notifications,darkmode,Java,Android,Notifications,Darkmode,我在android中创建了一个持久性通知,显示用户的学校时间表。 美丽的颜色-理论上: 不幸的是,如果我的设备(android 10)的暗模式被启用,颜色就会反转: 在模拟器中,颜色总是正确的 我尝试自己反转颜色,以在黑暗模式下获得正确的颜色,但当通知变为“lighty”时,颜色不再反转 有点奇怪。setDefaultNightMode()对通知的颜色没有影响 Notification notification = new NotificationCompat.Builder(contex

我在android中创建了一个持久性通知,显示用户的学校时间表。 美丽的颜色-理论上:

不幸的是,如果我的设备(android 10)的暗模式被启用,颜色就会反转:

在模拟器中,颜色总是正确的

我尝试自己反转颜色,以在黑暗模式下获得正确的颜色,但当通知变为“lighty”时,颜色不再反转


有点奇怪。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);