Ionic Cordova implements the monitoring of soft keyboards and operations

When working on a project today, some operations are hidden when the keyboard is displayed, and some operations are turned on when the keyboard is hidden. After searching online for a long time, I found the specific monitoring event, hereby record it for your reference:

First you need to add a plug-in:

cordova plugin add ionic-plugin-keyboard --save

1 .Soft keyboard display monitor

window.addEventListener('native.keyboardshow', function (e) { // todo operates when the keyboard is available //e.keyboardHeight represents the height of the software disk when it is displayed });

2. Soft keyboard hidden monitoring

window.addEventListener('native.keyboardhide', function (e) { // todo to operate when the keyboard is not available });

3. Open the soft keyboard

cordova.plugins.Keyboard.show();

4. Turn off the soft keyboard

cordova.plugins.Keyboard.close();

5. Determine whether the soft keyboard is available

cordova.plugins.Keyboard.isVisible

< p>Note that this is not a method, but an attribute.

6. Show and hide keyboard accessory bar

cordova.plugins .Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.hideKeyboardAccessoryBar< /span>(false);

7. Prohibit and allow sliding

cordova.plugins.Keyboard. disableScroll(true);cordova.plugins .Keyboard.disableScroll(false);
  • My Blog: Blog Portal
  • My Short Book: Short Book Portal
  • My CSDN: CSDN Portal
  • My GitHub: GitHub Portal

When working on a project today, some operations are hidden when the keyboard is displayed, and some operations are opened when the keyboard is hidden. After searching online for a long time, I found the specific monitoring event, hereby record it for your reference:

First you need to add a plug-in:

cordova plugin add ionic-plugin-keyboard --save

1 .Soft keyboard display monitor

window.addEventListener('native.keyboardshow', function (e) { // todo operates when the keyboard is available //e.keyboardHeight represents the height of the software disk when it is displayed });

2. Soft keyboard hidden monitoring

window.addEventListener('native.keyboardhide', function (e) { // todo to operate when the keyboard is not available });

3. Open the soft keyboard

cordova.plugins.Keyboard.show();

4. Turn off the soft keyboard

cordova.plugins.Keyboard.close();

5. Determine whether the soft keyboard is available

cordova.plugins.Keyboard.isVisible

Note that this is not a method, but an attribute.

6. Show and hide keyboard accessory bar

cordova.plugins .Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.hideKeyboardAccessoryBar< /span>(false);

7. Prohibit and allow sliding

cordova.plugins.Keyboard. disableScroll(true);cordova.plugins .Keyboard.disableScroll(false);
  • My Blog: Blog Portal
  • My Short Book: Short Book Portal
  • My CSDN: CSDN Portal
  • My GitHub: GitHub Portal

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3774 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.