The example in this article describes the way Android programming is set to Full-screen. Share to everyone for your reference, specific as follows:
In real-world application development, we sometimes need to set the activity to a full screen display, in general, there are two ways to set the Full-screen display effect. First, you can set it in code, and second, set the full screen through the manifest configuration file.
First: Set in code (as follows)
Package Xiaohang.zhimeng;
Import android.app.Activity;
Import Android.content.pm.ActivityInfo;
Import Android.os.Bundle;
Import Android.view.Window;
Import Android.view.WindowManager;
public class Activity01 extends activity {
@Override public
void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Set to no title bar
requestwindowfeature (window.feature_no_title);
Set to Full-screen mode
GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG _fullscreen);
Set to horizontal screen
setrequestedorientation (activityinfo.screen_orientation_landscape);
Setcontentview (R.layout.main);
}
But note: Set in the code, set untitled and set the full screen of two pieces of code to be placed in Setcontentview (R.layout.main); In front of this piece of code. Otherwise, it will be an error.
Second: Set up in the manifest configuration file
<?xml version= "1.0" encoding= "Utf-8"?> <manifest xmlns:android=
"http://schemas.android.com/apk/res/" Android "
package=" Com.ladygaga.playboy "
android:versioncode=" 1 "
android:versionname=" 1.0 ">
<USES-SDK android:minsdkversion= "8"/>
<application android:icon= "@drawable/icon" @ String/app_name ">
<activity android:name=" Com.ladygaga.test.ImageSwitcherTest "
android: Screenorientation= "sensor"
android:label= "@string/app_name" >
<intent-filter>
<action Android:name= "Android.intent.action.MAIN"/>
<category android:name= "Android.intent.category.LAUNCHER" "/>
</intent-filter>
</activity>
</application>
</manifest>
Or:
<?xml version= "1.0" encoding= "Utf-8"?> <manifest xmlns:android=
"http://schemas.android.com/apk/res/" Android "
package=" Com.ladygaga.playboy "
android:versioncode=" 1 "
android:versionname=" 1.0 ">
<USES-SDK android:minsdkversion= "8"/>
<application android:icon= "@drawable/icon"
android:theme= "@android: Style/theme.notitlebar.fullscreen"
android:label= "@string/app_name" >
<activity android: Name= "Com.ladygaga.test.ImageSwitcherTest"
android:label= "@string/app_name" >
<intent-filter >
<action android:name= "Android.intent.action.MAIN"/>
<category android:name= " Android.intent.category.LAUNCHER "/>
</intent-filter>
</activity>
</ Application>
</manifest>
Add attributes to nodes in the corresponding activity:
Copy Code code as follows:
Android:theme= "@android: Style/theme.notitlebar.fullscreen"
That is, you can set up an activity to display in full screen. If set to Android:theme= "@android: Style/theme.notitlebar" That is only set to no title state.
I hope this article will help you with the Android program.