安卓端实现键盘收缩视图:cordova-plugin-keyboard@1.2.0不兼容,求替代插件
Hey there! I’ve been in your shoes before—relying on a plugin that works great on one platform but falls flat on another is super frustrating. Since cordova-plugin-keyboard@1.2.0 doesn’t support Android, here are some reliable, cross-platform alternatives that’ll let you handle keyboard shrinking (and other keyboard controls) seamlessly on both iOS and Android:
cordova-plugin-ionic-keyboard
This is the go-to replacement for most developers, even if you’re not using Ionic (it plays nicely with vanilla Cordova too). It fully supports both Android and iOS, with features like:- Programmatically hiding/showing the keyboard
- Listening for keyboard show/hide events to adjust your UI
- Preventing content from being pushed up by the keyboard (if needed)
Install it with this command:
cordova plugin add cordova-plugin-ionic-keyboardExample code to hide the keyboard (just like your old plugin):
Keyboard.hide();cordova-plugin-keyboard-advanced
If you want to stick as close as possible to the originalcordova-plugin-keyboardAPI (so you don’t have to rewrite a ton of code), this fork adds full Android support while keeping all the familiar features. It includes extras like disabling the keyboard entirely, customizing input accessory views, and tracking keyboard height changes.
Install command:cordova plugin add cordova-plugin-keyboard-advancedcordova-plugin-native-keyboard
For more advanced customization needs, this plugin is a solid choice. It lets you tweak keyboard appearance, handle input events in real-time, and even customize the keyboard’s toolbar. It’s well-maintained and supports all modern Android versions.
Install with:cordova plugin add cordova-plugin-native-keyboard
Quick note: Don’t forget to remove your old plugin first to avoid conflicts:
cordova plugin remove cordova-plugin-keyboard
内容的提问来源于stack exchange,提问作者Rishabh Jain

