From: http://www.myexception.cn/android/448805.html
Set full screen for Android
Hide the title bar:
requestWindowFeature(Window.FEATURE_NO_TITLE);
Beyond the permitted range (ignore the status bar ):
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Enter full screen:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
Cancel full screen:
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
In
Android4.0The above method is invalid. You can try the following method: Enter full screen
WindowManager.LayoutParams params = getWindow().getAttributes();params.systemUiVisibility =View.SYSTEM_UI_FLAG_SHOW_FULLSCREEN;getWindow().setAttributes(params);
Cancel full screen
WindowManager.LayoutParams params = getWindow().getAttributes();params.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;getWindow().setAttributes(params);