我有以下布局:第一项下没有状态栏去
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.skillberg.weather.ui.activity.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/weather_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true" />
</android.support.design.widget.CoordinatorLayout>
和风格:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
我想要的状态栏下显示在RecyclerView的第一个项目(如工具栏),但它没有显示有:
然而,RecyclerView本身吸引下,状态栏,但似乎有一些顶级的填充其高度=状态栏的高度:
如何解决呢?这android:fitsSystemWindows="true"
到false
从RecyclerView删除android:fitsSystemWindows =“true” –
@VinayakB如果我删除它,它位于状态栏下方:https://i.imgur.com/RFySVcx.jpg – arts777
为什么不添加- true
在你的风格 –