安卓机器上测试,每一次打开软件 ,第一次触发调用软键盘,要延迟2-3秒才会出来,,,

然后再点的时候,就速度很快了,,这是什么原因??

代码如下:

var openSoftKeyboard = function() {

if(mui.os.ios) {

var webView = plus.webview.currentWebview().nativeInstanceObject();

webView.plusCallMethod({

"setKeyboardDisplayRequiresUserAction": false

});

} else {

var webview = plus.android.currentWebview();

plus.android.importClass(webview);

webview.requestFocus();

var Context = plus.android.importClass("android.content.Context");

var InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");

var main = plus.android.runtimeMainActivity();

var imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);

imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);

}

}

var openplkuang=function(){

setTimeout(function() {

document.getElementById('bottommsg').style.display='block';

openSoftKeyboard();

document.getElementById("plkuang").focus();

}, 500);

}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐