The easiest way to do that is using the following code:
#if ANDROID ( MyEntry.Handler.PlatformView as AndroidX.AppCompat.Widget.AppCompatEditText).ShowSoftInputOnFocus = true;#endif
And you can also custom the handler to disable or enable it:
CustomHandler.cs:
namespace MauiAppTest.Platforms.Android{ public class MyHandler : EntryHandler { public void DisableKeyboard() { PlatformView.ShowSoftInputOnFocus = false; } public void EnableKeyboard() { PlatformView.ShowSoftInputOnFocus = true; } }}
Use it in the MauiProgram.cs:
builder .UseMauiApp<App>() .UseMauiCommunityToolkit() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); }) .ConfigureMauiHandlers((handlers) => {#if ANDROID handlers.AddHandler(typeof(Entry),typeof(Platforms.Android.MyHandler));#endif });
Call the method in the code behind:
#if ANDROID (MyEntry.Handler as Platforms.Android.MyHandler).DisableKeyboard();#endif
In addition, when you change the property, you need to refocus the entry to show the KeyBoard.