简体   繁体   English

离子键盘事件无法在Android上触发

[英]ionic keyboard events not firing on android

After adding crosswalk to my ionic app I faced many issues with keyboard and overlapping content the only solution was adding adjust nothing then get the keyboard height as mentioned in ionic keyboard plugin 在向我的离子应用程序添加人行横道后,我遇到了许多键盘和内容重叠的问题,唯一的解决方案是不进行任何调整,然后按离子键盘插件中所述获得键盘高度

window.addEventListener('native.keyboardshow',function(e){
$(".msg_footer").css("bottom", e.keyboardHeight + "px");
 alert('Keyboard height is: ' + e.keyboardHeight);    
 });
window.addEventListener('native.keyboardhide',function(e){
   $(".msg_footer").css("bottom","0px");
alert('Keyboard height is: ' + e.keyboardHeight);    
});

with adjustResize events are fired and I got the alert message 带有adjustResize事件的事件被触发,我收到了警报消息

but with adjustNothing ,alerts are not fired any more 但是使用adjustNothing不会再触发警报

here is my app run function I set ionic full scree to true 这是我的应用程序运行功能,我将离子全屏设置为true

 myapp.run(function ($ionicPlatform) {
   $ionicPlatform.ready(function () {
  if (window.cordova && window.cordova.plugins.Keyboard) {

    cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    cordova.plugins.Keyboard.disableScroll(true);
  }
    if (window.StatusBar) {
    // org.apache.cordova.statusbar required
    StatusBar.styleDefault();
}
 ionic.Platform.isFullScreen = true;
 });

}); });

I had a similar issue where I saw some flickering on Android 5 and I had to set android:windowSoftInputMode="adjustPan" to get rid of that. 我遇到了类似的问题,我在Android 5上看到了一些闪烁,因此必须设置android:windowSoftInputMode="adjustPan"来消除该问题。 I also get the keyboard events fired. 我还触发了键盘事件。

Try with adjustPan to see if it works for you. 尝试使用AdjustPan看看它是否适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM