--This blog is just a summary of notes, detailed text please see
Http://www.jianshu.com/p/0acc12c29c1b?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io
Today I learned the solution of the immersive status bar--status bar, now do the recording
Immersive status bar can be implemented in two ways, one is solid color, one is to use the picture background to achieve
Let's start with a few pictures.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/81/FA/wKiom1dGlO2DBxFaAABI46wL4BE368.png "title=" Screenshot_2016-05-26-14-15-28_com.systembar.ddst.png "alt=" Wkiom1dglo2dbxfaaabi46wl4be368.png "/>650) this.width=650, "src=" Http://s3.51cto.com/wyfs02/M01/81/F9/wKioL1dGlhOgF634AA2LZ5Cw1vI814.png "title=" screenshot _2016-05-26-14-15-33_com.systembar.ddst.png "alt=" Wkiol1dglhogf634aa2lz5cw1vi814.png "/> These two graphs are two ways to implement the immersive status bar, The first is to fill the status bar with color, the second is the picture
Specifically, the implementation method
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/81/F9/wKioL1dGlySjfs4VAADh19dcm6Y423.png "style=" float: none; "Title=") {gwbc79loy@p0a~) o3qsi8.png "alt=" Wkiol1dglysjfs4vaadh19dcm6y423.png "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/81/FA/wKiom1dGli-gFb-NAACVxK1ekqs250.png "style=" float: none; "title=" 2tphxavk4rnu5~kfzs3_5ce.png "alt=" Wkiom1dgli-gfb-naacvxk1ekqs250.png "/>
The main code is here.
Status bar modification is only valid on Android 4.4 and above, so the new two style is above v19 and V21, of course 6.0 of which also build a v23 style
Create a style in v19 and V21 respectively
V21
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/81/F9/wKioL1dGmDGyDe_BAAFY4SojRHs610.png "style=" float: none; "Title=" (pxvunww]m) [{' z8qe3b% ' o.png ' alt= ' wkiol1dgmdgyde_baafy4sojrhs610.png '/>
V19
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/81/F9/wKioL1dGmDHD0tEBAADZ26wVhuw425.png "style=" float: none; "Title=" lzs}6ml (wyuqsj4{' [O7@16.png] alt= "Wkiol1dgmdhd0tebaadz26wvhuw425.png"/>
Image and color correspond to pictures and colors in two different scenarios
This is created when you need to configure a page with immersive effects in the manifest file
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/81/FA/wKiom1dGmTvDC-SPAAB8npHRuRg205.png "title=" RA] "( W98XT (K) WZG ' ~t]s$j.png "alt=" Wkiom1dgmtvdc-spaab8nphrurg205.png "/>
And then set the layout on the page
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/81/F9/wKioL1dGmoLi9aOmAACJTw7zU4w864.png "title=" amx~ l92m)]z) [evoyzc28zq.png "alt=" Wkiol1dgmoli9aomaacjtw7zu4w864.png "/>
It's going to work.
---------------------------------Split Line----------------------
After that, the color style can be exactly the same.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/81/FA/wKiom1dGmifDcdJyAAF4KTEuhjA438.png "title=" Ig6y31slqe2o[em{39fkqqo.png "alt=" Wkiom1dgmifdcdjyaaf4kteuhja438.png "/>
People always make progress.
Summarize the steps
1 builds the value-version according to the corresponding version, which establishes the relative style
2 Style Add three properties
<item name= "Android:windowtranslucentstatus" >true</item><item name= "Android: Windowtranslucentnavigation ">true</item><item name=" colorprimary "> @android:color/transparent< /item>
3 The theme of the page that needs to have an immersive status bar in the manifest file is set to the theme we created
4 setting properties at the root of the page
Android:fitssystemwindows= "true"
5 V21 below
Divide the root layout into two pieces--title layout and content layout, set the background of the title layout to the same as the root office, the content layout is set independently
That's it.
This article is from the "building the world with the keyboard" blog, please be sure to keep this source http://guo2android.blog.51cto.com/10476685/1783465
Two ways to implement immersive status bar