安卓:WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON问题 [英] Android: WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON question
问题描述
即时通讯使用以下code以保持在屏幕上:
Im using the following code to keep the screen on:
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
有没有什么办法来禁用/删除 FLAG_KEEP_SCREEN_ON
后来在code? (我想在屏幕正常淡出)。
Is there any way to disable/remove the FLAG_KEEP_SCREEN_ON
later in the code? (I want the screen to fadeout normally).
谢谢!
推荐答案
您也许可以做这样的事情
You could probably do something like this
this.getWindow().setFlags(this.getWindow().getFlags() & ~WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
你看看API?还有这种方法
Did you look at the API? There's also this method
的http://developer.android.com/reference/android/view/Window.html#clearFlags%28int%29
this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
我还没有尝试过这一点无论呢。
I have not tried this either yet.
我想这会工作,以检查是否设置了标志:
I imagine this will work to check if the flag is set:
this.getWindow()getFlags()及。 WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
this.getWindow().getFlags() & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
编辑:根据意见,显然这是你如何获得标志的值
As per the comments, apparently this is how you get the value of the flag.
this.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
有可能是一个方法也一样,你应该看看API文档。
There might be a method for that too, you should look at the API doc.
这篇关于安卓:WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!