NSNotificationCenter Swift 3.0 on keyboard show and hide

Swift 3: override func viewDidLoad() { super.viewDidLoad() NotificationCenter.default.addObserver(self, selector: #selector(ViewController.keyboardWillShow), name: Notification.Name.UIKeyboardWillShow, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(ViewController.keyboardWillHide), name: Notification.Name.UIKeyboardWillHide, object: nil) } func keyboardWillShow(notification: Notification) { if let keyboardSize = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue { print(“notification: Keyboard will show”) if self.view.frame.origin.y == 0{ self.view.frame.origin.y -= keyboardSize.height } } } func keyboardWillHide(notification: Notification) { if let keyboardSize … Read more

Android Use Done button on Keyboard to click button

You can use this one also (sets a special listener to be called when an action is performed on the EditText), it works both for DONE and RETURN: max.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { Log.i(TAG,”Enter … Read more

change keyboard layout with javascript

You won’t be able to change the keyboard layout using JS, but you can capture the keydown event and replace the character with something like this: http://jsfiddle.net/SxdKZ/ $(‘textarea’).on(‘keydown’, function(e){ console.log(e.keyCode); if( e.keyCode == 90 ){ e.preventDefault(); $(this).append(‘y’).focus(); } if( e.keyCode == 89 ){ e.preventDefault(); $(this).append(‘z’).focus(); } });​

Android EditText, soft keyboard show/hide event?

Hi I’d used following workaround: As far as my content view is a subclass of LinearLayout (could be any other view or view group), I’d overridden onMeasure method lilke following: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int proposedheight = MeasureSpec.getSize(heightMeasureSpec); final int actualHeight = getHeight(); if (actualHeight > proposedheight){ // Keyboard is … Read more