During development, we often need to set our application to full screen. There are two methods: one is to set in the code, and the other is to change it in the configuration file!
1. Set in the Code:
Copy codeThe Code is as follows: package com. android. tutor;
Import android. app. Activity;
Import android. OS. Bundle;
Import android. view. Window;
Import android. view. WindowManager;
Public class OpenGl_Lesson1 extends Activity {
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
// No title
RequestWindowFeature (Window. FEATURE_NO_TITLE );
// Full screen
GetWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN, WindowManager. LayoutParams. FLAG_FULLSCREEN );
// The two codes must be set before the setContentView () method.
SetContentView (R. layout. main );
}
}
2. Set in the configuration file (android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen "):
Copy codeThe Code is as follows: <? Xml version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package = "com. android. tutor"
Android: versionCode = "1"
Android: versionName = "1.0" type = "codeph" text = "/codeph">
<Application android: icon = "@ drawable/icon" android: label = "@ string/app_name">
<Activity android: name = ". OpenGl_Lesson1"
Android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen"
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>
<Uses-sdk android: minSdkVersion = "7"/>
</Manifest>
The second method is recommended!