Android hides the pitfalls in the top Status Bar and the top Status Bar of android

Source: Internet
Author: User

Android hides the pitfalls in the top Status Bar and the top Status Bar of android

Hide the pitfalls in the top status bar in Android

First, let's look at the general method of hiding the status bar:

Method 1:

@ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // remove the title requestWindowFeature (Window. FEATURE_NO_TITLE); // remove the status bar getWindow () above the Activity (). setFlags (WindowManager. layoutParams. FLAG_FULLSCREEN, WindowManager. layoutParams. FLAG_FULLSCREEN); setContentView (R. layout. video_view); initView ();}

Pit 1: the code above to hide the top status bar must be placed in setContentView (R. layout. video_view). This method does not work many times before. Therefore, the second method is recommended.

Method 2:

<activity            android:name="*.Activity"            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" ></activity>

Put: android: theme = "@ android: style/Theme. NoTitleBar. Fullscreen" in a separate Activity, which is only valid for the current Activity. To put the entire APP into the Application

Pit2: android: theme = "@ android: style/Theme. noTitleBar. fullscreen "if this line of code is configured in the Application, the entire APP Activity can only inherit from the Activity, not AppCompatActivity, because the Theme under AppCompatActivity can only be ActionBar;

Pit3: android: theme = "@ android: style/Theme. noTitleBar. if the Fullscreen line of code is set to only one Activity, you only need to ensure that the current Activity does not inherit the Activity rather than AppCompatActivity;

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.