Basic Android tutorial --- two full screen setting methods in Android !!!

Source: Internet
Author: User

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 ~

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.