GDK/APK for Google Glass-防止屏幕变暗 [英] GDK / APK for Google Glass - Keep screen from dimming

查看:86
本文介绍了GDK/APK for Google Glass-防止屏幕变暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处列出的四个示例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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆