0

I know there is a bug for the soft keyboard hiding and I have read the work arounds, but I just curious if anyone has found a solid solution that allow the keyboard to not appear at all without effect the runtime? Im trying to build a barcode scanner app but the soft keyboard keeps appearing when focusing on the entry or when the scanner is inputting the data. I would like it to work on both android and iOS. =(

  • What do you need an Entry for at all if you don't want to use the keyboard? – Julian Feb 17 '23 at 21:36
  • The device we are planning on using has a built in scanner and needs to have a entry to input the data (Keystroke) and I was going to use on text change to trigger the submission once it reaches the suffix of the data input. – ScottNoClue Feb 17 '23 at 21:45
  • *" I have read the work arounds"* Unless improved, this question will probably get closed as a duplicate or as too vague. Add links to the one(s) you tried, and show the **exact code** of your implementation. – ToolmakerSteve Feb 17 '23 at 23:50
  • Did the answer in the thread ["Need a way to hide soft keyboard in MAUI's Editor / Entry fields"](https://stackoverflow.com/questions/73199602/need-a-way-to-hide-soft-keyboard-in-mauis-editor-entry-fields) help you? – Zack Feb 20 '23 at 08:47

1 Answers1

0

In Maui, you can use Handler to achieve the effect you want on the iOS and Android platforms respectively. I did a simple test and the soft keyboard will not pop up on both platforms and the keyboard input can be performed normally. You can refer to this:

Xaml:

<Entry Text="111"/>

.cs

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();
        ModifyEntry();

    }

    void ModifyEntry()
    {
        Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
        {
#if ANDROID
            handler.PlatformView.EditorAction += (s, e) =>
            {
                handler.PlatformView.InputType = Android.Text.InputTypes.Null;
            };

#elif IOS

            handler.PlatformView.EditingDidBegin += (s, e) =>
            {
                handler.PlatformView.InputView=new UIKit.UIView();
                
            };
#endif
        });
    }

Hope it can help you. For more usage of Handler, you can refer to the document: Customize controls with handlers

Zack
  • 1,255
  • 1
  • 2
  • 5