Tuesday, 7 May 2019

Xamarin.Forms Android immersive mode with soft keyboard or Alert

I am trying to get my Xamarin.Forms application to use Android's immersive mode, since I am using a device with small screen, so soft keys and navigation bar is stealing my precious screen real estate.

Since the device I am using features hardware keyboard, I wanted to hide the soft keyboard. Currently I solved this by installing a "Null Input Method" keyboard. The keyboard is still there however, so every time focus is requested on Entry element, the keyboard is "shown". This causes application to exit immersive mode. The same is true when I show an Alert from my forms application.

Ideally I would want my application to stay in immersive mode all the time, at least when focus on Entry is requested (soft keyboard is not "shown" at all or immersive mode is not disabled when keyboard is "shown"). For Alerts I would like the application to reenter immersive mode when Alert is hidden. Currently I solved this by extending the Page class with custom DisplayAlert methos, which toggles immersive mode after DisplayAlert Task is completed.

I did some research and found the following articles: Immersive mode while using keyboard Appereantly user managed to solve the issue, so there could be a solution?

https://forums.xamarin.com/discussion/33034/prevent-entry-soft-keyboard-from-showing-on-android But this solution does not work on Entry elements, and I would like to avoid writing custom renderers for elements.

Is there someone that faced a similiar issue before and managed to solve it?



from Xamarin.Forms Android immersive mode with soft keyboard or Alert

No comments:

Post a Comment