あなたがリンクしたプラグインは私のために働きました(まったく同じ問題がありました):
$("#eingabe").blur(); //for ios
var softkeyboard = window.cordova.plugins.SoftKeyBoard;
softkeyboard.hide();
あなたはおそらく Cordova 2.0.0 (またはそれ以降) を使用しており、プラグイン ファイル (Phonegap < 2.0 用に記述されています) を変更していません。
更新されたファイルは次のとおりです(私が使用するもの):
ソフトキーボード.js
cordova.plugins = cordova.plugins || {};
cordova.plugins.SoftKeyBoard = {
show: function (win, fail) {
return cordova.exec(
function (args) { if (win !== undefined) { win(args); } },
function (args) { if (fail !== undefined) { fail(args); } },
'SoftKeyBoard', 'show', []
);
},
hide: function (win, fail) {
return cordova.exec(
function (args) { if (win !== undefined) { win(args); } },
function (args) { if (fail !== undefined) { fail(args); } },
'SoftKeyBoard', 'hide', []
);
},
isShowing: function (win, fail) {
return cordova.exec(
function (args) { if (win !== undefined) { win(args); } },
function (args) { if (fail !== undefined) { fail(args); } },
'SoftKeyBoard', 'isShowing', []
);
}
};
SoftKeyBoard.java
package org.apache.cordova.plugins;
import org.json.JSONArray;
import android.content.Context;
import android.view.inputmethod.InputMethodManager;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
public class SoftKeyBoard extends Plugin {
public SoftKeyBoard () { }
public void showKeyBoard () {
InputMethodManager mgr = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(webView, InputMethodManager.SHOW_IMPLICIT);
((InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(webView, 0);
}
public void hideKeyBoard() {
InputMethodManager mgr = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(webView.getWindowToken(), 0);
}
public boolean isKeyBoardShowing() {
// if more than 100 pixels, its probably a keyboard...
int heightDiff = webView.getRootView().getHeight() - webView.getHeight();
return (100 < heightDiff);
}
public PluginResult execute(String action, JSONArray args, String callbackId) {
if (action.equals("show")) {
this.showKeyBoard();
return new PluginResult(PluginResult.Status.OK, "done");
} else if (action.equals("hide")) {
this.hideKeyBoard();
return new PluginResult(PluginResult.Status.OK);
} else if (action.equals("isShowing")) {
return new PluginResult(PluginResult.Status.OK, this.isKeyBoardShowing());
} else {
return new PluginResult(PluginResult.Status.INVALID_ACTION);
}
}
}
config.xml を変更する
また、「 res/xml/config.xml」に次の行を必ず追加してください。
<plugin name="SoftKeyBoard" value="org.apache.cordova.plugins.SoftKeyBoard" />