CoordinatorLayout + immersive status bar, coordinatorlayout

Source: Internet
Author: User

CoordinatorLayout + immersive status bar, coordinatorlayout

No gif said * B

 

Pay attention to the changes in the status bar (if I were you, I wouldn't care about the toast below)

I checked a lot of articles and blogs for this effect ,, either the background of the starting image is not filled in the status bar or the background of the starting image is filled in the status bar, but the background color of the status bar changes when it is pulled up .... later, I could not find a better method, so I had to steal the chicken (coincidentally ).

Step 1: Set the immersive Status Bar

I don't know what's going on. I am here to paste the code, but I am always unable to paste it into fk... you have to work hard and have a lot of immersive status bar links on the Internet. You can check them out.

Walk you ----------------------------- >>> immersive Status Bar

Step 1

-V19

-V21

 

-V23

 

Step 2 set the CoordinatorLayout effect layout. If you haven't seen this layout, first check how it is implemented.

Walk you -------------------------- android CoordinatorLayout

Let's take a look at my overall layout.

 

Android CoordinatorLayout is used. If you have a good idea about this control, you should have no doubt about the layout file.

Step 3 set the immersive Status Bar

Add the topic we just set in the list file

 

TranslucentTheme is yours.

Did you find that my layout does not contain android: fitsSystemWindows = "true "?

If we do not set this sentence, it will hide our title bar under the status bar (yes, if this effect is correct)

Because the height of the mobile phone status bar is about 20dp, I moved the ToolBar to 20dp.

 

In this way, the gif effect will appear. Remember not to set android: fitsSystemWindows = "true ".

Okay, you can go to your project and have a look.

I am just a method to steal a chicken (I don't want to move down the ToolBar by 20 DP). I also don't have a better way. If you have a better way, please tell me.

This is my QQ 765307272. Please tell me.

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.