我有以下佈局:第一項下沒有狀態欄去
<?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
在你的風格 –