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);
}
要使用的时候直接调用方法boolean为true
注意:要达到全屏的话还要取消APP的title
怎样取消APP的title:http://www.cnblogs.com/zzw1994/p/4884757.html