【问题标题】:Android: JQuery-Mobile on "pageshow" softkeyboard not showing up the first time with CordovaAndroid:“pageshow”软键盘上的 JQuery-Mobile 未首次使用 Cordova 显示
【发布时间】:2015-12-09 19:24:52
【问题描述】:

我正在尝试使用 cordova 让键盘显示在 Android 的“pageshow”功能内。

假设将焦点放在输入字段(文本)中,并且假设会显示键盘。

它只关注输入字段,但键盘没有出现。

当我返回然后再次进入同一页面时,键盘出现。

有没有人知道为什么它没有第一次出现,或者知道任何解决方法?

这是我的代码:

var foundInput = null;
        var allInput = document.getElementsByTagName("input");
        for (var i = 0; i < allInput.length; ++i) {
            if (allInput[i].placeholder == "Search medication...") {
                foundInput = allInput[i];
            }
        }
        $(foundInput).focus();
        $(foundInput).trigger('click');

我还尝试将页面保存在不同的 html 中,并尝试将它们放在相同的 html 中。仍然有同样的问题。 谢谢

【问题讨论】:

    标签: javascript android cordova jquery-mobile soft-keyboard


    【解决方案1】:
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    

    将以上代码添加到 config.xml

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-27
      • 2020-10-27
      • 2013-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多