如何彻底隐藏的Andr​​oid导航条 [英] How to hide android nav bars completely

查看:175
本文介绍了如何彻底隐藏的Andr​​oid导航条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图隐藏的Andr​​oid导航条这样的:

I'm trying to hide android nav bars like that :

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void hideNavBarsParent(){
    mDecorView = getWindow().getDecorView();
    mDecorView.setOnSystemUiVisibilityChangeListener(
            new View.OnSystemUiVisibilityChangeListener() {
                @Override
                public void onSystemUiVisibilityChange(int flags) {
                   hideNavBars();
                }
            });
}

我打电话hideNavBars()那里,实现是 -

I'm calling hideNavBars() there, realisation is -

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void hideNavBars(){
    if(UrlWorker.isJelleyBean()) {
        mDecorView = getWindow().getDecorView();
        int uiOptions = 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_LOW_PROFILE;
        mDecorView.setSystemUiVisibility(uiOptions);

但是,一旦我的任意位置单击他们再次apear,所以我的问题是 - 因此,有没有办法隐藏时间在Android和LT;奇巧,并且不使用浸入式模式?

But once I click anywhere they apear again, so my question is - So there is no way to hide em in android < Kitkat and without using Immersion Mode?

然后我尝试了,因为这

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void hideNavBarsParent(){
    mDecorView = getWindow().getDecorView();
    mDecorView.setOnSystemUiVisibilityChangeListener
        (new View.OnSystemUiVisibilityChangeListener() {
    @Override
    public void onSystemUiVisibilityChange(int visibility) {
        // Note that system bars will only be "visible" if none of the
        // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
        if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
            hideNavBars();
        } else {
        }
    }

});
因此,他们必须反正躲在时候都可见,但...

}); So they must hide in anyway when they are visible, but...

推荐答案

使用View.SYSTEM_UI_FLAG_HIDE_NAVIGATION将隐藏导航栏,并提出了一个不可见的窗口,接收所有触摸事件阻止你的应用程序。接下来的触摸事件将打破玻璃,恢复导航栏。有没有办法改变之前的4.4的行为。

Using View.SYSTEM_UI_FLAG_HIDE_NAVIGATION will hide the navigation bar and put up an invisible window, blocking your app from receiving all touch events. The next touch event will "break the glass" and restore the navigation bar. There is no way to change that behavior prior to 4.4.

在4.4使用沉浸式模式使您可以通过一些额外的标志请求此行为的细微变化,让互动的应用程序没有导航栏。但导航栏总是可以从屏幕的底部轻扫恢复,并且该系统可以在任何时候恢复酒吧

Using Immersive Mode in 4.4 allows you to request a slight change to this behavior via some additional flags, allowing interactive apps without a navigation bar. But the navigation bar can always be restored with a swipe from the bottom of the screen, and the system can restore the bar at any time.

这篇关于如何彻底隐藏的Andr​​oid导航条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆