Remove the title bar and full screen for Android

Source: Internet
Author: User

It is easy for Android to remove the title bar and full screen. There are two common methods:
First: Implemented in program code
Java code

This. requestwindowfeature (window. feature_no_title); // remove the title bar this. getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen); // remove the Information bar this. requestwindowfeature (window. feature_no_title); // remove the title bar this. getwindow (). setflags (windowmanager. layoutparams. flag_fullscreen, windowmanager. layoutparams. flag_fullscreen); // remove the Information bar.

Note: The two lines of code should be written before the page is displayed, that is, before setcontentview (R. layout. XXX ).

Second, the Android: Theme tag is implemented in the androidmanifest. xml configuration file.
Java code

<Activity Android: Name = "activity1" Android: theme = "@ Android: style/theme. notitlebar. fullscreen"> </activity>

Note: If you do not need full screen, you only need to write Android: theme = "@ Android: style/theme. notitlebar.

Summary: differences between the two
If the first method is used, a short title bar and Information bar will appear when the activity is started, and then disappear.
This is not the case if you use the second method. You are recommended to use the second method, which looks smoother.

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.