即使我们离开了该活动(窗口),即使在我们离开该活动之后,如何保持屏幕的特定状态?
使用getWindow()。addflags(windowmanager.layoutparams.flag_keep_screen_on)
,它只能允许一个活动。如果我切换到另一个活动,而不是屏幕。
我的要求是:如果启用切换按钮 - 如果禁用屏幕在整个应用程序中都可以关闭,则不会关闭屏幕。
截至目前,不建议使用Android 11和12 wake_lock,因此欢迎使用此选项。
先感谢您。
Using getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
, It can only allow for one activity. If I switch to another activity than screen will goes off.
My requirement is : If toggle button enable - screen will not off, if disable screen can goes off THROUGHOUT the application.
WAKE_LOCK is not recommended for android 11 and 12 as of now so rather than this options are welcome.
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论