删除状态栏

时间:2018-01-27 15:56:38

标签: android statusbar android-launcher

我有一台带有root的Android 5.1平板电脑。我正在以kiosk模式实现一个应用程序。为此,我正在使用沉浸式模式,它很好地隐藏了导航和状态栏。但是,通过滑动,这些条重新出现,这不是我想要的。

qemu.hw.mainkeys=0添加到build.prop文件的末尾,我就可以摆脱导航(底部)栏。不幸的是,当我从屏幕的上方拉下时,状态栏仍会重新出现。

是否有可能通过编辑builds.prop文件或以其他方式摆脱状态栏?

1 个答案:

答案 0 :(得分:1)

不熟悉root设备,所以我想到不同的方式,你试着在主要活动中隐藏它吗?

View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
actionBar.hide();

这适用于4.1及更高版本,请参阅Android Developer

中的更多内容