1. Programming Method
Java code
Public void setFullScreenMethod1 (boolean isFullScreen ){
If (isFullScreen ){
GetWindow (). addFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN );
} Else {
GetWindow (). addFlags (WindowManager. LayoutParams. FLAG_FORCE_NOT_FULLSCREEN );
// You can also use the following to clear the Flag.
// GetWindow (). clearFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN );
}
}
Public void setFullScreenMethod2 (boolean isFullScreen ){
If (isFullScreen ){
GetWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN,
WindowManager. LayoutParams. FLAG_FULLSCREEN );
} Else {
GetWindow (). clearFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN );
}
}
2. Configure theme
You can also configure it in AndroidMenifest. xml. Add upper/lower attributes to an application or activity element
Xml Code
<Activity android: name = "XXX" android: theme = "@ android: style/Theme. NoTitleBar"/>
<Activity android: name = "XXX" android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen"/>
3. Use the style Method
Define the following style in the styles. xml file
Xml Code
<Style name = "FullScreenTheme">
<Item name = "android: windowNoTitle"> true </item>
<Item name = "android: windowFullscreen"> true </item>
<Item name = "android: windowContentOverlay"> @ null </item>
</Style>
Used in AndroidMenifest. xml
Xml Code
<Activity android: name = "XXX" android: theme = "@ android: style/FullScreenTheme"/>
Author "program life"