大佬教程收集整理的这篇文章主要介绍了android – 如何完全退出沉浸式全屏模式?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的方法:
// This snippet hides the system bars. @SuppressLint("NewApi") private void hidesystemUI() { try{ // Set the IMMERSIVE flag. // Set the content to appear under the system bars so that the content // doesn't resize when the system bars hide and show. mDecorView.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 // hide nav bar | View.SYstem_UI_FLAG_FULLSCREEN // hide status bar | View.SYstem_UI_FLAG_IMMERSIVE); }catch(Exception E){ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); } } // This snippet shows the system bars. It does this by removing all the flags // except for the ones that make the content appear under the system bars. @SuppressLint("NewApi") private void showsystemUI() { try{ mDecorView.setsystemUIVisibility( View.SYstem_UI_FLAG_LAYOUT_STABLE | View.SYstem_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYstem_UI_FLAG_LAYOUT_FULLSCREEN); }catch(Exception E){ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); mDecorView.setVisibility(View.GONE); mDecorView.setVisibility(View.VISIBLE); WindowManager.LayoutParams attrs = getWindow().getAttributes(); attrs.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; getWindow().setAttributes(attrs); mDecorView.setPadding(0,getStatusBarHeight(),0); } }
以上是大佬教程为你收集整理的android – 如何完全退出沉浸式全屏模式?全部内容,希望文章能够帮你解决android – 如何完全退出沉浸式全屏模式?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。