Hide those pits from the top status bar in Android

Source: Internet
Author: User

Hide those pits from the top status bar in Android

Let's look at the usual ways to hide the status bar:

Method One:

@Override     protected 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.video_view);        Initview ();    }

Pit 1: The code above to set the hidden top status bar must be placed in Setcontentview (R.layout.video_view);

Method Two:

<activity            android:name= "*. Activity "            android:theme=" @android: Style/theme.notitlebar.fullscreen "></activity>

Will: Android:theme= "@android: Style/theme.notitlebar.fullscreen" This line of work is only valid for the current activity in a separate activity, If you want the entire app to work, put it on application.

Pit 2:android:theme= "@android: Style/theme.notitlebar.fullscreen" This line of code if configured in application, The entire app activity can only be inherited from activity, cannot be appcompatactivity, because appcompatactivity under the theme can only be actionbar style;

Pit 3:android:theme= "@android: style/ Theme.NoTitleBar.Fullscreen This line of code if only set in a certain activity, so long as to ensure that the current activity is not to inherit activity rather than inherit appcompatactivity, other activity is arbitrary;

Hide those pits from the top status bar in Android

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.