In the development of Android applications, we will encounter some of the interface set to full-screen display format, there are two ways to implement. One is implemented in Java code, and the other is implemented in a configuration file.
1. Set in Java code
Super . OnCreate (savedinstancestate); Requestwindowfeature (window.feature_no_title); // No title GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_ fullscreen); // Full screen Setcontentview (R.layout.main);
It is important to note that both Java code must be placed in Setcontentview (); Before, otherwise it will error, the errors shown below.
2. Modify in the manifest file
Add Android:theme= "@android: Style/theme.notitlebar.fullscreen" to the default startup activity
<ActivityAndroid:name=". Mainactivity "Android:label= "@string/app_name"Android:theme= "@android: Style/theme.notitlebar.fullscreen" > <Intent-filter> <ActionAndroid:name= "Android.intent.action.MAIN" /> <categoryAndroid:name= "Android.intent.category.LAUNCHER" /> </Intent-filter> </Activity>
Two ways to achieve full-screen display in the Android interface