SmartTabLayout+CoordinatorLayout+RecycleView+沉浸式状态栏

效果图:
这里写图片描述android

遇到沉浸式状态栏头部为灰色:如图:git

这里写图片描述

解决方法:去掉根布局下fitsSystemWindows属性
所谓Systemwindows指的就是屏幕上statusbar、navigationbar等系统控件所占据的部分。而android:fitsSystemWindows=”true”就是经过设置View的padding,使得应用的content部分(Activity中setContentView()中传入的content)不会与system window重叠。github

这里写图片描述

状态栏和虚拟键出现半透明状:如图:web

这里写图片描述

引发缘由:在判断sdk版本大于等于21以后设置沉浸式状态栏,可是在AndroidMainfest中对这个Activit设置了一个主题:windows

android:windowTranslucentStatus:true 设置顶部状态栏透明
android:windowTranslucentNavigation:true 设置虚拟按键透明
android:statusBarColor 设置顶部状态栏颜色app

<style name="ColorTranslucentTheme2" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>

解决方法:去掉values-v21/style设置的主题svg

> github地址:https://github.com/hushendian/CoordinatorLayoutDemo.git布局

博客引用地址:http://www.jianshu.com/p/f09723b7e887
博客引用地址:http://www.jianshu.com/p/ac56f11e7ce1
博客引用地址:http://blog.csdn.net/guolin_blog/article/details/51763825
博客引用地址: http://blog.csdn.net/lizhiying61f/article/details/52213585spa