适合 SystemWindows 时,工具栏中的 searchView 有一个 paddingBottom

searchView in toolbar has a paddingBottom when fitsSystemWindows

在我的 style.xml:

    <item name="android:windowTranslucentStatus">true</item>

在我的 toolbar.xml:

    <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/AppTheme.PopupOverlay">

当我输入内容时,它看起来像: enter image description here

enter image description here

所以我的问题是: 为什么它有底部填充?以及,如何使用 fitsSystemWindows 但将底部填充设为零?

我的临时解决方案是: 使用 android:paddingTop="XXdp" 而不是 android:fitsSystemWindows="true"

但不够优雅

刚刚百度了一下,找到了完美的解决方案

http://www.th7.cn/Program/Android/201603/780326.shtml

只需将此添加到清单

android:windowSoftInputMode="adjustPan"