如何使用adjustResize去除屏幕顶部的白色条带

Hit*_*its 8 android android-layout

键盘打开时,屏幕顶部会出现白色条带,无论键盘状态如何变化,它都会持续存在.

如果我使用adjustPan它然后它工作,但是,我想adjustResize只使用.

这是问题的图像:


我在AndroidManifest.xml中的活动声明

<activity
    android:name=".MainActivity"
    android:screenOrientation="portrait"
    android:theme="@style/MyTheme"
    android:windowSoftInputMode="adjustResize"/>

<style name="MyTheme" 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="android:windowDrawsSystemBarBackgrounds" 
          tools:targetApi="lollipop">false</item>
</style>
Run Code Online (Sandbox Code Playgroud)

Gau*_*rma 1

KitKat 中有一种称为沉浸式全屏模式的技术。我认为它现在是实现全屏 Activity 的首选方式。

这是文档中的 示例。