Android status bar Transparent (immersive effect)

Source: Internet
Author: User

Android status bar Transparent (immersive effect) default effect

Immersive effects

Mode One source code

(Android Studio project): http://download.csdn.net/detail/q4878802/9058275

1. Modify the status bar and navigation bar properties to be transparent
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {    //透明状态栏    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);    //透明导航栏    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);}

and found the top and bottom are transparent, the view occupies the entire screen position, and the titlebar position is not moving

2. Keep the displayed view to its own size

To add a property on the root node of the view's XML

android:clipToPadding="true"android:fitsSystemWindows="true"

3. Hide TitleBar

Modify Application Theme

android:theme="@android:style/Theme.Black.NoTitleBar"

Test Toast shape

See post someone said this way toast will shape, I tested it, no shape.

Mode two source code

(Android Studio project): http://download.csdn.net/detail/q4878802/9058365

1. Modify the theme

Modify the theme of application

android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.TranslucentDecor"

Or

android:theme="@android:style/Theme.Holo.Light.NoActionBar.TranslucentDecor"

Or

android:theme="@android:style/Theme.Holo.NoActionBar.TranslucentDecor"

2. Keep the displayed view to its own size

To add a property on the root node of the view's XML

android:clipToPadding="true"android:fitsSystemWindows="true"

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. All articles, any technical point, whether original or reproduced, are used in the program or demo test before publishing! Bo Master qq:4878802.

Android status bar Transparent (immersive effect)

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.