Hide title bar and status bar in Android

Source: Internet
Author: User

Http://www.cnblogs.com/zhuguangwei/archive/2011/01/18/1938276.html

First, hide the title bar

Hide title bar

This.requestwindowfeature (Window.feature_no_title);

Second, hide the status bar

Hide the status bar

This.getwindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_ fullscreen);

Third, remove the title bar of all activity interface

Modify Androidmanifest.xml

Add Android:theme= "@android: Style/theme.notitlebar" in the application tag

Iv. removing the titlebar and statusbar from all activity interfaces

Modify Androidmanifest.xml

In the Application tab, add

Android:theme= "@android: Style/theme.notitlebar.fullscreen"

Android dynamic display and hide status bar (notification bar)

1, set in the activity's OnCreate:

GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);

GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

2, call when you need to show and hide:

private void Hidestatusbar () {
Windowmanager.layoutparams attrs = GetWindow (). GetAttributes ();
Attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
GetWindow (). SetAttributes (Attrs);
}

private void ShowStatusBar () {
Windowmanager.layoutparams attrs = GetWindow (). GetAttributes ();
Attrs.flags & Amp;= ~windowmanager.layoutparams.flag_fullscreen;
GetWindow (). SetAttributes (Attrs);
}

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.