Android transparent Status Bar

Source: Internet
Author: User

Android transparent Status Bar

The Android transparent status bar is available only after 4.4.

You can set two methods:

1.

If (Build. VERSION. SDK_INT> = Build. VERSION_CODES.KITKAT) {// transparent status bar getWindow (). addFlags (WindowManager. layoutParams. FLAG_TRANSLUCENT_STATUS); // transparent navigation bar getWindow (). addFlags (WindowManager. layoutParams. FLAG_TRANSLUCENT_NAVIGATION );}
This setting causes the VIEW to be moved to the top. You can use the following method to set the layout file (the red part ):

 

 

 
  android:fitsSystemWindows="true"    android:clipToPadding="true"    android:paddingBottom="@dimen/activity_vertical_margin"    tools:context=".MainActivity">
 
FitsSystemWindows: whether to consider the system window layout when setting the application layout; if it is true, the system window layout will be adjusted to adapt to your custom layout. For example, if the system has a status bar or an application has a status bar. According to your layout code, it is precisely in the definition of the title bar style, so this line of code is used.

 

ClipToPadding:Whether to allow ViewGroup painting in padding. The default value is true, that is, not allowed.

2. Set in THEME:

 

    android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor"                android:theme="@android:style/Theme.Holo.Light.NoActionBar.TranslucentDecor"                android:theme="@android:style/Theme.Holo.NoActionBar.TranslucentDecor"
You can add the following attributes to the values-19 file:

 

 

 



 

 

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.