【发布时间】:2017-10-04 10:48:51
【问题描述】:
我有以下布局:
<?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 本身在状态栏下绘制,但似乎有一些顶部填充,其高度 = 状态栏高度:
如何解决?
【问题讨论】:
-
从 RecyclerView 中移除 android:fitsSystemWindows="true"
-
@VinayakB 如果我删除它,它会位于状态栏下方:i.imgur.com/RFySVcx.jpg
-
你为什么不在你的风格中添加
- true
标签: android android-recyclerview material-design android-statusbar