public void toggleFullscreen(boolean fullScreen) { //fullScreen为true时全屏,否则相反 WindowManager.LayoutParams attrs = getWindow().getAttributes(); if (fullScreen) { attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; } else { attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; } getWindow().setAttributes(attrs); }
原文:http://blog.csdn.net/zhangphil/article/details/43767671