private void toggleKeyboard(OnscreenKeyboardMode mode) { RunOnUiThread(() => { fireInputs = false; editText.Text = ""; fireInputs = true; InputMethodManager inputMethod = GetSystemService(InputMethodService) as InputMethodManager; switch (mode) { case OnscreenKeyboardMode.Hidden: inputMethod.HideSoftInputFromWindow(editText.WindowToken, 0); break; case OnscreenKeyboardMode.Secure: editText.InputType = InputTypes.TextVariationWebPassword; inputMethod.ShowSoftInput(editText, ShowFlags.Forced); break; //Make normal and default the same in case we add a type but we haven't added it here yet. case OnscreenKeyboardMode.Normal: default: //editText.InputType = InputTypes.ClassText | InputTypes.TextFlagMultiLine; //Allows for autocorrect editText.InputType = InputTypes.TextVariationWebPassword | InputTypes.TextFlagMultiLine; inputMethod.ShowSoftInput(editText, ShowFlags.Forced); break; } }); }
private static extern void NativeOSWindow_setOnscreenKeyboardMode(IntPtr nativeWindow, OnscreenKeyboardMode mode);