如果用户点击不在软键盘或编辑文本上的空格,对话框将会解除,在这种情况下如何解除键盘?
答案 0 :(得分:0)
使用此
JSON.stringify(obj, function(k,v)
{
if (v instanceof Array)
return JSON.stringify(v);
return v;
}, 4);
答案 1 :(得分:0)
尝试使用此方法隐藏键盘:
public void hideKeyboard(Activity activity) {
try {
InputMethodManager inputManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager!=null) {
if (activity.getCurrentFocus() == null)
return;
if (activity.getCurrentFocus().getWindowToken() == null)
return;
inputManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0);
}
} catch (Exception hideKeyboardException) {
// handle exception here
}
}
如果您没有任何活动,请从此方法中删除活动对象。
答案 2 :(得分:0)
我不确定,可能会有所帮助
public void hideSoftKeyboard() {
View view = this.getCurrentFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}