private void toggleFullscreen(boolean fullscreen) { WindowManager.LayoutParams attrs = getWindow().getAttributes(); if (fullscreen) { attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; } else { attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; } getWindow().setAttributes(attrs); }
想要全屏就传一个"true"进去吧~
stackoverflow 上有关全屏的讨论 点击打开链接