Android Full Screen Settings with no title, android full screen with no title

Source: Internet
Author: User

Android Full Screen Settings with no title, android full screen with no title
Title Bar and status bar

By default, the Android program contains the status bar and title bar.

Create an Android program in Eclipse. After running the program, it is displayed as follows:

The figure shows the status bar (display time, battery power, network, etc.) and the title bar (display the application name, that is, the android: label attribute value of activity ).

To hide the title bar and status bar, you can set either in the Code or in the manifest file.

The following describes how to set in the code.

 

Set in Java code

  Hide the title bar:

Public class MainActivity extends Activity {@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // This part of content must be called before setContentView () // remove the Window title requestWindowFeature (Window. FEATURE_NO_TITLE); // load the layout setContentView (R. layout. activity_main );}}

 

The effect is as follows:

 

  Hide the title bar and the status bar to display the Activity in full screen.:

Package com. example. fullscreen; import android. OS. bundle; import android. view. window; import android. view. windowManager; import android. app. activity; public class MainActivity extends Activity {@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // This part of content must be called before setContentView () // remove the Window title requestWindowFeature (Window. FEATURE_NO_TITLE); // hide the status bar and display it in full screen. // The first is getWindow (). addFlags (WindowManager. layoutParams. FLAG_FULLSCREEN); // Method 2: (two methods have the same effect) // getWindow (). setFlags (WindowManager. layoutParams. FLAG_FULLSCREEN, // WindowManager. layoutParams. FLAG_FULLSCREEN); // load the layout setContentView (R. layout. activity_main );}}

The effect is as follows:

 

 

Set in the Manifest File

  Another way to set full screen is to set the style in the AndroidManifest. xml file.,

  

At this time, no title or full screen setting code needs to be added to the Activity code. The effect is as follows:

Source: http://www.cnblogs.com/mengdd/p/3177284.html

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.