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

效果图:
这里写图片描述

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

这里写图片描述

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

这里写图片描述

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

这里写图片描述

引起原因:在判断sdk版本大于等于21之后设置沉浸式状态栏,但是在AndroidMainfest中对这个Activit设置了一个主题:

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

<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设置的主题

> 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/52213585

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值