怎么走(不是看不见)NavigationBar?

Ima*_*shi -4 java android fullscreen uinavigationbar navigationbar

我尝试通过以下代码隐藏NavigationBar:

public static void setFullscreen(final View decorView) {
    decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                decorView.setSystemUiVisibility(
                        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);
            }

        }
    });

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
        decorView.setSystemUiVisibility(decorView.getSystemUiVisibility());
    }
}
Run Code Online (Sandbox Code Playgroud)

并为每个活动:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        getWindow().getDecorView().setSystemUiVisibility(
                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);}
}
Run Code Online (Sandbox Code Playgroud)

和活动主题:

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">true</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我成功隐藏了NavifationBar,但NavigationBar只是看不见,没有消失!

真正的问题是如何走向导航栏?

抱歉我的英语不好.

小智 5

您不需要单独的查询只是为了通过NOW()获取当前时间,您可以将其合并到您的查询中

DELETE FROM current_questions WHERE createTime > NOW() - INTERVAL 1 MINUTE 
Run Code Online (Sandbox Code Playgroud)

那是createTime一分钟以前的事.

另外重要的是要知道mysql扩展已被弃用并且将来会被删除:使用mysqli或PDO代替