GDK/APK for Google Glass-防止屏幕变暗 [英] GDK / APK for Google Glass - Keep screen from dimming
问题描述
在此处列出的四个示例APK项目中,代码的哪一部分阻止了Google Glass屏幕变暗?
What part of the code in the four sample APK projects listed here for Google Glass prevents the screen from dimming?
当我编写自己的APK并将其侧面加载时,十秒钟没有点击,屏幕变暗了,但没有关闭.
When I write my own APK and sideload it, after ten seconds with no tapping, the screen dims but does not turn off.
我可以使用哪些清单更改或代码更改来防止屏幕变暗.
What manifest change or code change can I use to prevent the screen from dimming.
谢谢!是否应该有Google-Glass-GDK标签?如果是这样,请添加它.
Thanks! Should there be a Google-Glass-GDK tag? If so add it please.
推荐答案
有两种简单的方法可以执行此操作而无需请求唤醒锁:
There are a couple easy ways you can do this without requesting a wake lock:
-
将
android:keepScreenOn="true"
属性添加到布局的根元素.
Add the
android:keepScreenOn="true"
attribute to the root element of your layout.
或者,在您的onCreate
方法中执行以下操作:
Or, do the following in your onCreate
method:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
这篇关于GDK/APK for Google Glass-防止屏幕变暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!