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
blockquote>
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