Forum Xamarin Xamarin.Android

White screen when closing Android keyboard

HapaxHapax Member ✭✭

I'm creating an hybrid application with WebView system and I have an issue with Android : when I tap on an input, the keyboard shows up, I write what I want and when the keyboard disappear, he leaves a white background that makes its size.

Here is a screeshot of the problem. First screen is when the keyboard is open and the second one is when the keyboard is closed.

I did a lot of research and still haven't found a good solution...

Here is my MainActivity :

And here my androidManifest :

I’ve tried almost every windowSoftInputMode but none seem to work.
Do you have any idea to help me ? Thanks in advance.

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai

    Try to set WindowSoftInputMode to SoftInput.AdjustNothing or SoftInput.SoftInput.AdjustResize.

    [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true,WindowSoftInputMode = Android.Views.SoftInput.AdjustResize)]
    //WindowSoftInputMode = Android.Views.SoftInput.AdjustNothing
    

    AdjustResize: the window will be adjusted to accommodate the soft input window.
    AdjustNothing: The window will not be resized, and it will not be panned to make its focus visible.

    Tutorial:
    https://developer.android.com/guide/topics/manifest/activity-element#wsoft

  • HapaxHapax Member ✭✭

    Thank you for your answer but I have already tried all WindowSoftInputMode ... None seem to work.

  • JarvanJarvan Member, Xamarin Team Xamurai

    Does this issue occur on all devices? Or is it only for certain levels or devices?

  • HapaxHapax Member ✭✭

    Looks like the bug mainly happens on recent devices

  • JarvanJarvan Member, Xamarin Team Xamurai

    If it is confirmed to be a bug, you can report the issue on github.

  • Pooja105Pooja105 Member ✭✭

    @Hapax Did you find any solution to get rid of the white space in android?

  • HapaxHapax Member ✭✭

    Unfortunately, I don't think so. By the way, if anyone has an answer, don't hesitate to share it.

Sign In or Register to comment.