Android immersive status bar settings (4.4 or later)

Source: Internet
Author: User

In fact, the setup is relatively simple, I used a few models of Xiaomi and HTC can be used.

The main code is this (note to call before the activity's Setcontentview)

/**       * Open the immersive status bar      */public     staticvoid  Openimmersestatasbarmode (activity activity) {        if (Build.VERSION.SDK_INT >=  Build.version_codes. KITKAT) {            = Activity.getwindow ();            Window.setflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT _status);            Window.setflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_ translucent_navigation);        }    }

Then set the application theme style to no theme in manifest android:theme= "@android: Style/theme.notitlebar" >

This is set up after the run for, you will find the content and status bar overlap, it's OK, set a paddingtop on the line.

Demo Address: Http://files.cnblogs.com/files/wangyuehome/TestStatusBar.zip

Android immersive status bar settings (4.4 or later)

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.