image
Jan 08, 2019

To avoid soft keyboard overlap


Very often an app has input fields. For instance a login screen like shown in image below:

Input fields

In Android it could happen that when you want to enter the password,  the password field is overlapped by the (soft) keyboard and you don't see if you have entered something.

Password_Keyboard_Overlap

To prevent from happening in Android you can add the following in the codebehind of App.xama

using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using Xamarin.Forms.Xaml;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace Xamarin_PWA
{
    public partial class App : Xamarin.Forms.Application
    {
        public App()
        {
            InitializeComponent();

            //To avoid soft keyboard statusbar overlap
            Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

            MainPage = new MainPage();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}

 
When you enter the password, you still see what you have entered.

NoKeyboardOverlap

About us

Milèstre is a digital development agency based in Maastricht and operating all over the world. Since 2003 we build software solutions together with established companies and great startups. During the years we have developed a process that enables us to transform ideas into meaningful, intelligent and designfull experiences for mobile and web. A process where strategy, design, development and user experience are playing an important rol.

 

Contact us

Milestre BV
Ambyerstraat Zuid 82
6225 AJ Maastricht
Netherlands

Tel: +31(0)43 - 4070780
Email: info@milestre.nl
Recent Posts

Jan 08, 2019

To avoid soft keyboard overlap


Very often an app has input fields. For instance a login screen like shown in image below:

Input fields

In Android it could happen that when you want to enter the password,  the password field is overlapped by the (soft) keyboard and you don't see if you have entered something.

Password_Keyboard_Overlap

To prevent from happening in Android you can add the following in the codebehind of App.xama

using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
using Xamarin.Forms.Xaml;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace Xamarin_PWA
{
    public partial class App : Xamarin.Forms.Application
    {
        public App()
        {
            InitializeComponent();

            //To avoid soft keyboard statusbar overlap
            Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);

            MainPage = new MainPage();
        }

        protected override void OnStart()
        {
            // Handle when your app starts
        }

        protected override void OnSleep()
        {
            // Handle when your app sleeps
        }

        protected override void OnResume()
        {
            // Handle when your app resumes
        }
    }
}

 
When you enter the password, you still see what you have entered.

NoKeyboardOverlap

© Copyright 2022 - Milestre BV
Top