During development, we often need to set our applications to full screen. Here I know two methods. One is to set them in code, another way is to change it in the configuration file!
1. Set in the Code:
Package COM. android. tutor; <br/> Import android. app. activity; <br/> Import android. OS. bundle; <br/> Import android. view. window; <br/> Import android. view. windowmanager; <br/> public class opengl_lesson1 extends activity {<br/> Public void oncreate (bundle savedinstancestate) {<br/> super. oncreate (savedinstancestate); <br/> // No title <br/> requestwindowfeature (window. feature_no_title); <br/> // full screen <br/> getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, <br/> windowmanager. layoutparams. flag_fullscreen); </P> <p> setcontentview (R. layout. main); <br/>}< br/>}
It should be emphasized that the full screen code must be before setcontentview (R. layout. Main), or an error will be reported.
2. modify it in the configuration file (Android: theme = "@ Android: style/theme. notitlebar. fullscreen "):
<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <manifest xmlns: Android = "http://schemas.android.com/apk/res/android" <br/> package = "com. android. tutor "<br/> Android: versioncode =" 1 "<br/> Android: versionname =" 1.0 "> <br/> <application Android: icon = "@ drawable/icon" Android: Label = "@ string/app_name"> <br/> <activity Android: Name = ". opengl_lesson1 "<br/> Android: theme =" @ Android: style/theme. notitlebar. fullscreen "<br/> Android: Label =" @ string/app_name "> <br/> <intent-filter> <br/> <action Android: Name =" android. intent. action. main "/> <br/> <category Android: Name =" android. intent. category. launcher "/> <br/> </intent-filter> <br/> </activity> <br/> </Application> <br/> <uses-SDK Android: minsdkversion = "7"/> <br/> </manifest>
Here I would like to explain that the former will see a short status bar after we run the application, and then the full screen will be displayed. This is not the case in the second method, so I suggest
Use the latter! Thank you ~