Set full screen

Source: Internet
Author: User

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"
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.