Android Implementation transparent status bar

Source: Internet
Author: User

The main use of Https://github.com/jgilfelt/SystemBarTint this open source Library

1, import Systembartintmanager class

2, Basefragmentactivity's oncreate add the following code:

 //  Modify the status bar color, 4.4+ effective  if  (Build.VERSION.SDK_INT >= Build.version_codes.        KITKAT) {settranslucentstatus (); } systembartintmanager Tintmanager  = new  Systembartintmanager (this  ); Tintmanager.setstatusbartintenabled ( true         ); Tintmanager.setstatusbartintresource (R.COLOR.STATUS_BAR_BG);  //  The notification bar needs the color, the color content in the Colors.xml file defines the  
@TargetApi (protected)    void  settranslucentstatus () {        = GetWindow ();         // Translucent status Bar         window.setflags (                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);         // Translucent navigation bar         window.setflags (                WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,                WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);    }

3, pay special attention to the following code, otherwise the display layout will be problematic:

<xmlns:android= "http://schemas.android.com/apk/res/android"    Android : layout_width= "Match_parent"    android:layout_height= "Match_parent"     Android:background = "#f1f1f1"  android:cliptopadding= "true" >

For more information on how to use: http://www.jcodecraeer.com/a/opensource/2014/1222/2198.html

Android Implementation transparent status bar

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.