我正在开发一个需要全屏模式的应用程序.

我试图在我的清单中使用此代码,
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Run Code Online (Sandbox Code Playgroud)
但没有任何事情发生,按钮栏(如Home,Back和Recent Task App)仍在那里.我需要隐藏它们才能完全拥有全屏.请帮我解决一下这个.谢谢.
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
Run Code Online (Sandbox Code Playgroud)
从API 19以后,你可以使用SYSTEM_UI_FLAG_IMMERSIVE_STICKYflag:
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
Run Code Online (Sandbox Code Playgroud)
看到这里的文档
| 归档时间: |
|
| 查看次数: |
2458 次 |
| 最近记录: |