Android status bar transparent (immersive effect), android status bar immersed

Source: Internet
Author: User

Android status bar transparent (immersive effect), android status bar immersed
Android status bar transparent (immersive effect) default Effect

Immersive Effect

Method 1 source code

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

1. Modify the properties of the status bar and navigation bar to transparent
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 );}

It is found that the top and bottom are transparent, and the View occupies the position of the entire screen, while the TitleBar is not

2. Keep the displayed View size.

Add attributes to the XML root node of View

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

3. Hide TitleBar

Modify application topic

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

Test Toast

Someone posted a Post saying that Toast would be out of shape in this way. I tested it and it was not out of shape.

Method 2 source code

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

1. Modify the topic

Modify the topic of an 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 size.

Add attributes to the XML root node of View

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

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger. All articles, any technical point, whether original or reprinted, are published only after being used in the program or tested in the Demo! QQ: 4878802.

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.