Andriod full screen processing (Video Player)
1. Introduction
In Android applications, some require full screen, excluding the Status Bar (System Status Bar), the title Bar (ActionBar), and the Navigation Bar (Navigation Bar ), this status is the Immpresion mode defined in Google API. this mode is often used by game applications.
In addition, some applications need to switch between full-screen and non-full-screen modes, such as video players.
2. UI Flag
(1) display StatusBar and Navigation Bar
mShowFlags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; mAnchorView.setSystemUiVisibility(mShowFlags);
(2) Hide StatusBar and Navigation Bar
mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; mAnchorView.setSystemUiVisibility(mHideFlags);
3. ActionBar OverLay
Set the ActionBar to the upper layer of the View.
requestWindowFeature(Window.FEATURE_ACTION_BAR); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);