Search code examples
androidxamarinwebviewkeyboard

Resize webview when I show the keyboard


I created a webview (xamarin - Android) but when I press on a textbox the keyboard is positioned above the webview and there is a button positioned at the bottom of the page. The webview is not resized. On Chrome the button is on top of the keyboard


Solution

  • Add WindowSoftInputMode = Android.Views.SoftInput.AdjustResize to your Activity attribute:

    [Activity(Label = "@string/app_name", 
        MainLauncher = true, 
        LaunchMode = Android.Content.PM.LaunchMode.SingleTop, 
        Icon = "@drawable/icon",
        WindowSoftInputMode = Android.Views.SoftInput.AdjustResize)]
    public class MainActivity : AppCompatActivity