Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.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
在android 6.0(棉花糖)中,当用户处于非活动状态时,屏幕变暗_Android_Android 6.0 Marshmallow - Fatal编程技术网

在android 6.0(棉花糖)中,当用户处于非活动状态时,屏幕变暗

在android 6.0(棉花糖)中,当用户处于非活动状态时,屏幕变暗,android,android-6.0-marshmallow,Android,Android 6.0 Marshmallow,我使用以下代码在Android上调暗屏幕。 除了6.0版(棉花糖)之外,它在android版本中运行良好 Android 6.0版如何解决这个问题 WindowManager.LayoutParams params = getActivity().getWindow().getAttributes(); params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; params.screenBrightness = 0f; get

我使用以下代码在Android上调暗屏幕。 除了6.0版(棉花糖)之外,它在android版本中运行良好

Android 6.0版如何解决这个问题

WindowManager.LayoutParams params = getActivity().getWindow().getAttributes();
params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
params.screenBrightness = 0f;
getActivity().getWindow().setAttributes(params);