gpt4 book ai didi

android - 在android中隐藏按钮栏

转载 作者:行者123 更新时间:2023-11-29 14:50:06 24 4
gpt4 key购买 nike

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

enter image description here

我试图在我的 list 中使用这段代码,

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

但什么也没发生,按钮栏(例如“主页”、“返回”和“最近的任务应用程序”)仍然存在。我需要隐藏它们才能完全显示全屏。请在这件事上给予我帮助。谢谢。

最佳答案

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);

参见 developer docs

从 API 19 以后,您可以使用 SYSTEM_UI_FLAG_IMMERSIVE_STICKY 标志:

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);

参见文档 here

关于android - 在android中隐藏按钮栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21225424/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com