'White background shows during 1 sec when keyboard closes on Android
When I tap to close the virtual keyboard, white background is shown on that place for 1 second.
I use Activity(WindowSoftInputMode = SoftInput.AdjustResize)
to push “Done” button above the virtual keyboard but see a white background.
If I use Activity(WindowSoftInputMode = SoftInput.AdjustPan)
there is no white background, but there is no "Done" button above.
How to fix a white background using 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>
Theme:
<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>
Solution 1:[1]
I solved the problem using the code below: FindViewById(Android.Resource.Id.Content).RootView.SetBackgroundColor(Color.Transparent);
Solution 2:[2]
I know it is an old question but the way I did it was setting the android:windowBackground in to the right color:
<item name="android:windowBackground">@color/black</item>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Yevhen Kuraiev |
Solution 2 | Uriel Frankel |