Android Untitled fullscreen settings

Source: Internet
Author: User

title bar and status bar

The Android program, by default, contains the status bar and the title bar.

Create a new Android program in Eclipse, which appears as follows:

The figure shows the status bar (display time, battery level, network, etc.) and the title bar (which displays the name of the app, the property value of the activity's Android:label).

To hide the title bar and status bar, there are two ways to do this in general, one in code and one in the manifest file.

The methods set in the code are described below.

Set in Java code

  Hide title bar:

public class Mainactivity extends activity{    @Override    protected void onCreate (Bundle savedinstancestate)    {        super.oncreate (savedinstancestate);        This part of the content must be called before Setcontentview ()/        /Remove the window title        requestwindowfeature (window.feature_no_title);        Load Layout        setcontentview (r.layout.activity_main);}    }

The effect is as follows:

  hide the title bar and hide the status bar so that activity is displayed 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 the content must be called before Setcontentview ()/        /Remove the window title        requestwindowfeature (window.feature_no_title);        Hide status bar, full screen        //First type:        GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_FULLSCREEN);        The second type: (Two ways effect)        //GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,        // WindowManager.LayoutParams.FLAG_FULLSCREEN);        Load Layout        setcontentview (r.layout.activity_main);}    }

The effect is as follows:

Set in the manifest file

  another way to set up a full screen: Set the style in the Androidmanifest.xml file ,

  

At this time, the activity code does not need to add any title and full-screen settings of the code, the effect is as follows:

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

Android Untitled fullscreen settings

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.