Imitation iOS transparent notification bar (only 4.4 or more versions supported)

Source: Internet
Author: User

Since 4.4, Google has added a transparent status bar and navigation bar to Android, adding a small amount of code to it.


Add properties to the activity's layout file parent view:android:fitssystemwindows= "true " and android:cliptopadding= "true" .

<scrollview xmlns:android= "http://schemas.android.com/apk/res/android"    xmlns:custom= "http// Schemas.android.com/apk/res-auto "    android:layout_width=" match_parent "    android:layout_height=" Match_ Parent "    android:fitssystemwindows=" true "    android:cliptopadding=" true "    android:background=" # ffe5ff3e ">    <linearlayout        android:layout_width=" match_parent "        android:layout_height=" Match_ Parent "        android:orientation=" vertical ">        <textview            android:layout_width=" Match_parent "            android:layout_height= "match_parent"            android:padding= "16DP"            android:textsize= "18SP"            android:text= "@string/mytext"/>    </LinearLayout></ScrollView>

If you don't want to Actionbar, you can get rid of it in androidmanifest.xml or activity. However, the transparency notification bar supports only more than 4.4 of the system, and the default notification bar is displayed below 4.4.


If you want to change the color of the notification bar, refer to the demo from GitHub Daniel:

Https://github.com/jgilfelt/SystemBarTint

The library has only one Systembartintmanager class that can be copied to its own project, so it doesn't have to rely on that library.

Imitation iOS transparent notification bar (only 4.4 or more versions supported)

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.