Android immersive status bar and top status bar background color settings

Source: Internet
Author: User

Now many applications are referencing the immersive status bar, such as QQ, effect:

  

The effect is very cool, in fact, the setting is very simple. However, it is important to note that this effect can only be done in API19 and above.

  Method One:

First, if you want to achieve this effect in the interface activity, in Setcontentview (r.layout.xx); Method before adding the following code:

if (VERSION. sdk_int>=// transparent status bar  // transparent navigation bar GetWindow (). Addflags (Windo        WManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); }

Note: Version_codes. KITKAT is the name of API19, only the phone system SDK version is greater than 19, only execute the code in the judgment, to show the effect of the immersion status bar.

Second, the API is changed to more than 19, and the Layout root tag adds a background color.

Android immersive status bar and top status bar background color settings

Related Article

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.