效果图:
yyg
设置:
1、布局,AppBarlayout结合ToolBar,根布局设置android:fitsSystemWindows="true",AppBarLayout设置app:elevation="0dp" 否则toolbar与statusbar之间有分隔线
yyg
2、activity引入ToolBar
yyg
3、manifests中设置acticity主题
yyg
4、AppThem中设置主题,更改actionbar和statusbar对应的颜色colorpPimary和colorPrimaryDark,使这两个颜色值一致,即你要设置的“沉浸式”颜色
yyg