Android immersive notification bar design

Source: Internet
Author: User

Reprinted blog: http://www.2cto.com/kf/201503/381348.html

Android4.4 new features, System status bar integration.

The steps to be implemented include the following:

1.android4.4 or later

2. Set the app fullscreen:

Method: Set Android:theme= "@android: Style/theme.translucent.notitlebar" in Androidmanifest.xml

3. Load Nineoldandroids-2.4.0.jar

4. Implementation class: Set the status bar background to full transparency.

The project structure diagram is as follows:

  

The main method of invocation is implemented in Mainactivity.java as follows:

 Public classmainactivity extends activity{@Overrideprotected voidonCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);        Settranslucentstatus ();    Setcontentview (R.layout.activity_main); }         /** * Set status bar background status*/    Private voidSettranslucentstatus () {if(Build.VERSION.SDK_INT >=Build.version_codes. KITKAT) {Window win=GetWindow (); Windowmanager.layoutparams Winparams=win.getattributes (); FinalintBITS =WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; Winparams.flags|=bits;        Win.setattributes (Winparams); } Systemstatusmanager Tintmanager=NewSystemstatusmanager ( This); Tintmanager.setstatusbartintenabled (true); Tintmanager.setstatusbartintresource (0);//status bar no background    }}

Note: This is a new feature of android4.4 and supports only 4.4 or more versions

Here are the following:

  

Resource Address: Http://pan.baidu.com/s/1o6pbfIU

Android immersive notification bar design

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.