Full Screen in Android and full screen in Android
Two methods are generally available for full screen. The first method is to configure in the festxml file:
That is, add android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen" to the activity node ":
<activity android:name="com.howlaa.girlsos.FirstActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
The second method is written in java code, in the onCreate () method of activity:
RequestWindowFeature (Window. FEATURE_NO_TITLE); // you can specify getWindow (). setFlags (WindowManager. LayoutParams. FILL_PARENT, WindowManager. LayoutParams. FILL_PARENT ).
Note that it is written before the setContentView method; otherwise, an error is reported!
How does one display full screen in Android development?
In the onCreate () function of the first Activity of the Android Application
Run the following code:
This. requestWindowFeature (Window. FEATURE_NO_TITLE );
This. getWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN,
WindowManager. LayoutParams. FLAG_FULLSCREEN );
Note: The above two lines of code should be written on setContentView (R. layout. main.
The following is a full screen Activity code:
Public class MainActivity extends Activity {
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
// Hide the title bar (Application name)
This. requestWindowFeature (Window. FEATURE_NO_TITLE );
// Hide the status bar (battery and other icons and all modifiers)
This. getWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN,
WindowManager. LayoutParams. FLAG_FULLSCREEN );
SetContentView (R. layout. main );
}
}
How can an Android app be displayed in full screen?
There are two ways to set full screen display for Android apps. The first is to configure in the AndroidManifest. xml file, and the other is to set in Activity. Only the second method is described here.
To enable full screen display, you must cancel the title bar and display it in full screen. The Code is as follows: 1 @ Override2publicvoidonCreate (Bundle savedInstanceState) {3 super
. OnCreate (savedInstanceState); 4 // do not display the title bar on the screen (must be executed before the setContentView method is executed) 5 this
. RequestWindowFeature (Window. FEATURE_NO_TITLE); 6 // hide the status bar to display the content in full screen (must be executed before the setContentView method is executed) 7 this
. GetWindow (). setFlags (WindowManager. layoutParams. FLAG_FULLSCREEN, 8WindowManager. layoutParams. FLAG_FULLSCREEN); 9 setContentView (R. layout. splash); 10} stressed that during full screen display, the core code of the two lines must be executed before the view is set, that is, it must be prior to the setContentView () method.