点击以关闭虚拟键盘时,该位置上显示白色背景1秒钟。
我使用Activity(WindowSoftInputMode = SoftInput.AdjustResize)
按下虚拟键盘上方的“完成”按钮,但看到白色背景。
如果我使用Activity(WindowSoftInputMode = SoftInput.AdjustPan)
,则没有白色背景,但是上方没有“完成”按钮。
如何使用AdjustResize修复白色背景?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/itemsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/doneButton"
android:layout_width="match_parent"
android:layout_height="48dp"
android:visibility="gone" />
</LinearLayout>
主题:
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#f2f2f2</item>
<item name="colorPrimaryDark">#f2f2f2</item>
<item name="colorAccent">#f2f2f2</item>
<item name="colorControlHighlight">@color/blue</item>
</style>
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
<item name="colorAccent">#979797</item>
</style>
答案 0 :(得分:0)
我使用以下代码解决了该问题:FindViewById(Android.Resource.Id.Content).RootView.SetBackgroundColor(Color.Transparent);