Android activity removes title bar and status bar

Source: Internet
Author: User

One, set in code
public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);//Remove title Requestwindowfeature (   Window.feature_no_title); Remove the status bar above activity GetWindow (). SetFlags (Windowmanager.layoutparams. Flag_fullscreen, Windowmanager.layoutparams.     Flag_fullscreen); Setcontentview (R.layout.main); }
Or
Requestwindowfeature (Window.feature_custom_title); GetWindow (). Setfeatureint (Window.feature_custom_title, r.layout.custom_title_1);
R.layout.custom_title_1, this is your title. File layout
Second, modify in the configuration file
(Key code: Android:theme= "@android: Style/theme.notitlebar.fullscreen", if you want to just remove the title bar on the back without adding fullscreen, in addition, If you want the entire app to remove the title bar and the status bar, add this code to <application. In the tag, if you just want an activity to work, the code is added to the corresponding activity):
To hide the title bar you need to use a predefined style: Android:theme= "@android: Style/theme.notitlebar".
Hide the status bar: Android:theme= "@android: Style/theme.notitlebar.fullscreen". Here I also want to explain, with the former after our application run, you will see a short status bar, and then the full screen, and the second method is not the case, so I recommend you use the latter!

Tle_1, this is your title. File layout
Second, modify in the configuration file
(Key code: Android:theme= "@android: Style/theme.notitlebar.fullscreen", if you want to just remove the title bar on the back without adding fullscreen, in addition, If you want the entire app to remove the title bar and the status bar, add this code to <application. In the tag, if you just want an activity to work, the code is added to the corresponding activity):
To hide the title bar you need to use a predefined style: Android:theme= "@android: Style/theme.notitlebar".
Hide the status bar: Android:theme= "@android: Style/theme.notitlebar.fullscreen". Here I also want to explain, with the former after our application run, you will see a short status bar, and then the full screen, and the second method is not the case, so I recommend you use the latter!

Android activity removes title bar and status bar

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.