美文网首页
Android 隐藏底部导航栏和状态栏,动态调用导航栏,键盘收回

Android 隐藏底部导航栏和状态栏,动态调用导航栏,键盘收回

作者: D___Will | 来源:发表于2019-06-14 17:12 被阅读0次

private void hideNavigationBar() {

Window window= getWindow();

    WindowManager.LayoutParams params = window.getAttributes();

    params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE|View.SYSTEM_UI_FLAG_FULLSCREEN;

    window.setAttributes(params);

    int uiFlags = 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 // hide nav bar

            | View.SYSTEM_UI_FLAG_FULLSCREEN; // hide status bar

    if (Build.VERSION.SDK_INT >=19) {

uiFlags |=0x00001000;  //SYSTEM_UI_FLAG_IMMERSIVE_STICKY: hide navigation bars - compatibility: building API level is lower thatn 19, use magic number directly for higher API target level

    }else {

uiFlags |= View.SYSTEM_UI_FLAG_LOW_PROFILE;

    }

getWindow().getDecorView().setSystemUiVisibility(uiFlags);

}

相关文章

网友评论

      本文标题:Android 隐藏底部导航栏和状态栏,动态调用导航栏,键盘收回

      本文链接:https://www.haomeiwen.com/subject/weipfctx.html