如何完全退出沉浸式模式?
我的方法:
// 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); } }
如何让内容再次显示在系统栏下?
解决方法 使用VIEw.SYstem_UI_FLAG_VISIBLE调用setsystemUIVisibility()会清除所有标志:getwindow().getDecorVIEw().setsystemUIVisibility(VIEw.SYstem_UI_FLAG_VISIBLE);总结
以上是内存溢出为你收集整理的android – 如何完全退出沉浸式全屏模式?全部内容,希望文章能够帮你解决android – 如何完全退出沉浸式全屏模式?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)