隐藏导航栏后在Android KitKat上显示导航栏

隐藏导航栏后在Android KitKat上显示导航栏

问题描述:

在我的应用中,我想让用户隐藏或显示导航栏(后退,主页,菜单).系统栏(电池,wifi,通知)应始终处于隐藏状态.

In my app I want to let the user hide or show the Navigation Bar (back, home, menu). The System Bar (battery, wifi, notifications) should always be hidden.

我用以下代码隐藏系统栏:

I hide the System Bar with this code:

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

并且我成功隐藏了带有以下标志的导航栏:

And I am successfully hiding the Navigation Bar with these flags:

final static int flagsHide = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

但是我还没有发现如何再次显示导航栏.我可以用标志来做还是需要其他东西?系统栏必须保持不可见.

But I haven't found on how to show the Navigation Bar again. Can I do that with flags or do I need something else? The System Bar has to stay invisible.

使用此标志再次显示它

    SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN  |
 SYSTEM_UI_FLAG_LAYOUT_STABLE