In the actual application development, we sometimes need to set the Activity to display the full screen, in general, there are two ways to set the screen display effect. One is to set the full screen through the manifest configuration file by setting it in code.
One: Set it in code (below):
1 Public voidonCreate (Bundle savedinstancestate) {2 Super. OnCreate (savedinstancestate); 3 4 //Set Untitled5 requestwindowfeature (Window.feature_no_title); 6 //Set Full Screen7 GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,8 WindowManager.LayoutParams.FLAG_FULLSCREEN); 9 Ten Setcontentview (R.layout.main); One}
However, it is important to note that in the code, set the untitled and set the full screen of the two-segment code to be placed in the Setcontentview (R.layout.main); In front of this piece of code. Otherwise you will get an error.
Second: Set in the manifest configuration file:
1 <?XML version= "1.0" encoding= "Utf-8"?> 2 <Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" 3 Package= "Com.andyidea" 4 Android:versioncode= "1" 5 Android:versionname= "1.0"> 6 <USES-SDKandroid:minsdkversion= "8" /> 7 <ApplicationAndroid:icon= "@drawable/icon"Android:label= "@string/app_name"> 8 <ActivityAndroid:name= ". Login. Loginactivity " 9 android:theme= "@android: style/android. Notitlebar.fullscreen " Ten Android:label= "@string/app_name"> One <Intent-filter> A <ActionAndroid:name= "Android.intent.action.MAIN" /> - <categoryAndroid:name= "Android.intent.category.LAUNCHER" /> - </Intent-filter> the </Activity> - </Application> - </Manifest>
Add a property to the node in the corresponding activity: android:theme= "@android: Style/theme.notitlebar.fullscreen" To set an activity full-screen display. If set to Android:theme= "@android: Style/theme.notitlebar" is just set to untitled state.
Android (Java) Learning Note 242: How to set up full-screen multimedia