Android是什么:在Android身临其境的属性清单文件? [英] What is android:immersive attribute in Android manifest file?

查看:230
本文介绍了Android是什么:在Android身临其境的属性清单文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为谷歌玻璃的应用程序,我正面临着问题,我的活动。他们结束了,当我没有与他们进行互动为7至10秒。屏幕关闭,我拍了拍我的酒杯,再次唤醒它后,我的活动都会消失,我是在确定玻璃屏幕。

我搜索了很多,但找不到任何解决这个。然后,我碰到这个的android:在活动身临其境属性中的的Andr​​oidManifest.xml 文件

使用的android后:在我的活动身临其境=真正的(AndroidManifest.xml文件)。我的活动保持活着屏幕超时,当我敲击玻璃触摸板我的活动恢复后还是一样。它的行为是如何想象的默认行为。

所以我想知道是什么的android:身临其境属性,为什么心不是有关于它的任何文档?
也仅仅是只有在GDK?

可用此属性

我附上按行业生命周期中生成的日志,以便人们能有一个更好的了解。

  //日志时产生的android:身临其境=假还是不好用11月1日至30日:58:51.433:E /生命周期(5643):在OnCreate()
11月1日至30日:58:51.433:E /生命周期(5643):在onStart()
11月1日至30日:58:51.441:E /生命周期(5643):onResume()
11月1日至30日:59:05.566:E /生命周期(5643):的onPause()
11月1日至30日:59:05.574:E /生命周期(5643):的onSaveInstanceState()
11月1日至30日:59:05.581:E /生命周期(5643):的onStop()
11月1日至30日:59:11.511:E /生命周期(5643):onRestart()
11月1日至30日:59:11.511:E /生命周期(5643):在onStart()
11月1日至30日:59:11.535:E /生命周期(5643):onResume()
11月1日至30日:59:11.597:E /生命周期(5643):的onPause()
11月1日至30日:59:11.988:E /生命周期(5643):的onSaveInstanceState()
11月1日至30日:59:11.988:E /生命周期(5643):的onStop()//日志时产生的android:身临其境=真11月1日至30日:50:41.995:E /生命周期(4929):在OnCreate()
11月1日至30日:50:41.995:E /生命周期(4929):在onStart()
11月1日至30日:50:41.995:E /生命周期(4929):onResume()
11月1日至30日:50:56.324:E /生命周期(4929):的onPause()
11月1日至30日:50:56.347:E /生命周期(4929):的onSaveInstanceState()
11月1日至30日:50:56.347:E /生命周期(4929):的onStop()
11月1日至30日:51:09.144:E /生命周期(4929):onRestart()
11月1日至30日:51:09.144:E /生命周期(4929):在onStart()
11月1日至30日:51:09.167:E /生命周期(4929):onResume()


解决方案

国旗,宣布本次活动是'身临其境';身临其境的活动不应与其它活动或通知被打断。从 http://developer.android.com/reference/android/R。 attr.html#身临其境

奇怪的是,既然API级别11这个标志已问世,但身临其境模式,这是一种增强的全屏模式,只在API级别19被加入。

I was developing an app for Google glass and i was facing a problem with my activity. They ended when i didn't interact with them for 7 to 10 seconds. After the screen turned off and i tapped my glass to wake it up again, my activity would disappear and i was on ok glass Screen.

I searched a lot but couldn't find any solution to this. Then i came across this android:immersive attribute in Activity in AndroidManifest.xml file.

After using android:immersive="true" in my activity (AndroidManifest.xml file). My activity stays alive even after screen is timed out and my activity resumes when i tap the glass touchpad. Its behaviour is how i imagined the default behaviour.

So i was wondering what is android:immersive attribute and why isnt there any documentation regarding it? Also is this attribute only available only in the GDK ?

I am attaching logs that were generated by activity life cycle so that people can have a better understanding.

//LOGS GENERATED WHEN android:immersive="false" or NOT USED  

01-30 11:58:51.433: E/LifeCycle(5643): OnCreate()
01-30 11:58:51.433: E/LifeCycle(5643): onStart()
01-30 11:58:51.441: E/LifeCycle(5643): onResume()
01-30 11:59:05.566: E/LifeCycle(5643): onPause()
01-30 11:59:05.574: E/LifeCycle(5643): onSaveInstanceState()
01-30 11:59:05.581: E/LifeCycle(5643): onStop()
01-30 11:59:11.511: E/LifeCycle(5643): onRestart()
01-30 11:59:11.511: E/LifeCycle(5643): onStart()
01-30 11:59:11.535: E/LifeCycle(5643): onResume()
01-30 11:59:11.597: E/LifeCycle(5643): onPause()
01-30 11:59:11.988: E/LifeCycle(5643): onSaveInstanceState()
01-30 11:59:11.988: E/LifeCycle(5643): onStop()



//LOGS GENERATED WHEN android:immersive="true"

01-30 11:50:41.995: E/LifeCycle(4929): OnCreate()
01-30 11:50:41.995: E/LifeCycle(4929): onStart()
01-30 11:50:41.995: E/LifeCycle(4929): onResume()
01-30 11:50:56.324: E/LifeCycle(4929): onPause()
01-30 11:50:56.347: E/LifeCycle(4929): onSaveInstanceState()
01-30 11:50:56.347: E/LifeCycle(4929): onStop()
01-30 11:51:09.144: E/LifeCycle(4929): onRestart()
01-30 11:51:09.144: E/LifeCycle(4929): onStart()
01-30 11:51:09.167: E/LifeCycle(4929): onResume()

解决方案

"Flag declaring this activity to be 'immersive'; immersive activities should not be interrupted with other activities or notifications." from http://developer.android.com/reference/android/R.attr.html#immersive

The weird thing is that this flag has been available since API level 11, but the "immersive mode", which is an enhanced fullscreen mode, has only been added in API level 19.

这篇关于Android是什么:在Android身临其境的属性清单文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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