2013/03/08

Android 全螢幕切換

Android 全螢幕切換, 可透掛以下方式達成.
private void toggleFullscreen() {
 WindowManager.LayoutParams attrs = getWindow().getAttributes();
 
 if ((attrs.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
  attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
 } else {
  attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
 }
 getWindow().setAttributes(attrs); 
}

沒有留言:

張貼留言