如何在android应用程序中永久隐藏导航栏?
问题描述:
我有一个问题隐藏导航栏在Android屏幕的底部。 我试过的每个解决方案都不能像我想要的那样工作,除了一个。 使用新条目'qemu.hw.mainkeys = 1'修改build.prop可以正常工作,但会禁用整个android系统的导航栏。 有没有可能禁用这样的导航栏只适用于一个应用程序?如何在android应用程序中永久隐藏导航栏?
答
(Source)
试试这个:
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);
答
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
使用此代码的onCreate(),它会隐藏状态栏和导航栏,直到用户从屏幕顶部向下滑动
[永久隐藏导航栏上的活动]的可能重复(http://stackoverflow.com/questions/1671) 3845 /永久隐藏导航栏上活性) –