键盘打开时,屏幕顶部会出现白色条带,无论键盘状态如何变化,它都会持续存在.
如果我使用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>
解决方法
KitKat中有一种名为
Immersive Full-Screen Mode的技术.我认为现在它是实现全屏活动的首选方式.
这是来自文档的example.