0

I am working on a Xamarin Forms project.

We are testing a Android Device running KitKat that has a 12 key keyboard.

I am trying to force the softinput keyboard from showing when focus is given to an Entry for which I created a custom Renderer which overrides the FocusChange and Clicked events.

It kinda works as I detect if the device has a physical keyboard and if the entryKeyboard is numeric. If both those conditions are true, I call

        Control.ShowSoftInputOnFocus = false;

AND

            imm.HideSoftInputFromWindow(Control.WindowToken, HideSoftInputFlags.None);

It mostly works, except when the view containing the Entry editor opens. the keyboard is shown for a few moments and then it disappears. That's a problem on 2 fronts. It moves up the buttons that end up at the bottom of the view while the keyboard is measured, so buttons appear, move up and then back down when keyboard ultimately disappears. Second, once in a while it doesn't work. We have put a few delays, but that only compounds the problem since the keyboard ends up on screen longer.

In a perfect world, I don't care about the delays, I just don't want the softInput to show up anywhere in this view unless I specifically ask for it,

Alternately, I would not mind writing my own invisible keyboard and have to show (invisibly) while the async process is performing.

I have been searching everywhere for a while, so any help would be greatly appreciated.

thanks in advance and have a nice day

1 Answer 1

1
+50

I think you need to make a custom renderer for your EditText's. Then also create your own implementation of EditText which overrides the OnCheckIsTextEditor method, which simply returns false.

If you are only targeting Android API 21 and up, you can alternatively just call ShowSoftInputOnFocus = false on all your EditText instances. This could probably be done with an Effect in Xamarin.Forms.

Sign up to request clarification or add additional context in comments.

1 Comment

It's probably my understanding of order of operations which limits my capacity to fix the problem. As of now, my work around functionality is accepted as is, but I would really like to disable the pop of the virtual keyboard for a given view

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.