示例#1
0
        private void HideSoftKeyboard(object sender, EventArgs args)
        {
            if (CurrentFocus != null)
            {
                var inputMethodManager = (InputMethodManager)GetSystemService(InputMethodService);
                inputMethodManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);

                CurrentFocus.ClearFocus();
            }
        }
        public void HideSoftKeyboard()
        {
            if (CurrentFocus != null)
            {
                var inputMethodManager = (InputMethodManager)GetSystemService(InputMethodService);
                inputMethodManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);

                CurrentFocus.ClearFocus();
            }
        }
示例#3
0
        public void HideSoftInput()
        {
            if (CurrentFocus != null)
            {
                CurrentFocus.ClearFocus();

                using (var inputMethodManager = (InputMethodManager)GetSystemService(InputMethodService))
                    inputMethodManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);
            }
        }
示例#4
0
 public Keycode OnKeyPressed(Keycode keycode)
 {
     if (CurrentFocus.GetType() == typeof(Android.Support.V7.Widget.AppCompatEditText))
     {
         CurrentFocus.DispatchKeyEvent(new KeyEvent(KeyEventActions.Down, keycode));
         CurrentFocus.DispatchKeyEvent(new KeyEvent(KeyEventActions.Up, keycode));
         if (keycode == Keycode.Enter)
         {
             CurrentFocus.ClearFocus();
         }
     }
     return(keycode);
 }
示例#5
0
        private void Drawer_DrawerOpened(object sender, DrawerLayout.DrawerOpenedEventArgs e)
        {
            if (CurrentFocus == null)
            {
                return;
            }

            InputMethodManager inputMethodManager = (InputMethodManager)this.GetSystemService(Android.Content.Context.InputMethodService);

            inputMethodManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, 0);

            CurrentFocus.ClearFocus();
        }