效果圖:
yyg
設(shè)置:
1、布局,AppBarlayout結(jié)合ToolBar,根布局設(shè)置android:fitsSystemWindows="true",AppBarLayout設(shè)置app:elevation="0dp" 否則toolbar與statusbar之間有分隔線
yyg
2、activity引入ToolBar
yyg
?3、manifests中設(shè)置acticity主題
yyg
4、AppThem中設(shè)置主題,更改actionbar和statusbar對應(yīng)的顏色colorpPimary和colorPrimaryDark,使這兩個顏色值一致,即你要設(shè)置的“沉浸式”顏色
yyg