如何在不与 FLAG_KEEP_SCREEN_ON 冲突的情况下将屏幕调暗至零
我找到了几种调暗屏幕的方法,但我不确定它们如何与 FLAG_KEEP_SCREEN_ON:
- <一href="https://stackoverflow.com/questions/3496806/what-is-the-proper-way-to-dim-the-screen">Settings.System.SCREEN_BRIGHTNESS
- IHardwareService.setScreenBacklight()
href="https://stackoverflow.com/questions/3496806/what-is-the-proper-way-to-dim-the-screen/5287368#5287368"> WindowManager.LayoutParams.screenBrightness 即使我将亮度设置为0.0,上述方法也会保持屏幕打开吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有什么可以可靠地工作。如果您在某些设备上将亮度设置为 0,它会关闭屏幕(但设备会处于一种有趣的状态大约 5 秒左右,然后才真正意识到它已关闭并发挥作用)。有些设备它会亮起但呈黑色。
IIRC LayoutParams.screenBrightness 的值小于 30 是不可靠的,因为它可能会关闭显示。
在 AMOLED 设备上,全黑的全屏不会有背光。但SLCD肯定会的。此外,在 Android 3.0 上,您无法全屏显示,因为系统栏始终可见。
Nothing will work reliably. If you set the brightness to 0 on some devices it will turn off the screen (but the device will be in a funny state for about 5 seconds or so before really realizing it's off and acting as such). Some devices it will be on but black.
IIRC LayoutParams.screenBrightness with a value less than 30 is unreliable in that it might turn off the display.
On an AMOLED device a full screen that's all black will not have backlight. But SLCD definitely will. Also on Android 3.0 you can't have a full screen as the system bar is always visible.