【问题标题】:In Phonegap The input is covered by the keyboard once tap the input field在Phonegap中,一旦点击输入字段,输入就会被键盘覆盖
【发布时间】:2014-10-31 08:32:20
【问题描述】:

点击页面底部的文本输入,会出现一个虚拟键盘(如预期的那样)。问题是虚拟键盘与焦点文本输入重叠。因此,当我输入时,我看不到正在输入的内容。我也无法向下滚动到底部以查看文本框,因为页面总是会重新弹出。我正在使用 Phonegap 3.5 和 jquery 1.9.1 的版本

【问题讨论】:

    标签: javascript css cordova


    【解决方案1】:

    我通过focusinfocusout jquery 方法解决了它:

    //JS : OnReady event:
    
    var windowHeightSeventyPercent = parseInt(screen.height * 0.7); //To support multiple devices
    
    $("input").focusin(function(){
        $("body").height($("body").height()+parseInt(windowHeightSeventyPercent)); //Make page body scroll by adding height to make user to fillup field.
    });
    
    $("input").focusout(function(){
      $("body").height($("body").height()-parseInt(windowHeightSeventyPercent));
    });
    

    Please refer this thread.

    【讨论】:

    • 应用后你修复了同样的问题,你可以看看这个链接。 jsfiddle.net/4dLwezw1/3
    • 您在使用Phonegap Build 吗?如果是这样,请分享config.xml 文件?非常感谢。
    【解决方案2】:

    将以下首选项添加到 config.xml

    <preference name="android-windowSoftInputMode" value="adjustResize|stateHidden" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-02
      • 1970-01-01
      • 2014-07-29
      相关资源
      最近更新 更多