Android的全屏活动编程 [英] Android FullScreen Activity Programmatically

查看:133
本文介绍了Android的全屏活动编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以acheive与

I know that I can acheive that with:

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

我有一个设置活动,用户可以在其中设置全屏模式。当他回来的主要活动,当然如果他选中全屏,活动必须恢复全屏。

I have a Settings Activity, where the user can set Fullscreen mode. When he comes back to the Main Activity, of course if he checked Fullscreen, the Activity must resume Fullscreen.

如何做到这一点?

感谢您的帮助。

推荐答案

当U使用此。我想给一个尝试乌尔getWindow()。setFlags()在onResume()或者我给一个链接,这可能会帮助ü乌拉圭回合case.U可以设置或删除那些之前设置的条件。

As u are using this which must be used before setContentView(int). i think give a try ur getWindow().setFlags() in onResume() alternatively i am giving a link which might help u for ur case.U can set condition before setting or removing those.

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

您可以使用下面的链接,你的目的是做同样为Android 4.4或4.4 below.Android(API等级19)介绍了setSystemUiVisibility新SYSTEM_UI_FLAG_IMMERSIVE标志(),可以让您的应用程序去真正的全屏。对于较低版本以及链接通过设置标志有一些解决办法ü可以使用。

You can use following link for your purpose which is doing the same for android 4.4 or below.Android 4.4 (API Level 19) introduces a new SYSTEM_UI_FLAG_IMMERSIVE flag for setSystemUiVisibility() that lets your app go truly "full screen. For lower ver as well link has some workaround by setting flags u can use.

  https://developer.android.com/samples/ImmersiveMode/src/com.example.android.immersivemode/ImmersiveModeFragment.html

有关删除标志ü也有 clearFlag()这需要当u增加了目的。

for remove flags u also have clearFlag() which u added for purpose when needed.

这篇关于Android的全屏活动编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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