InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(getWindow().getDecorView()
.getWindowToken(), 0);
}
if (imm != null) {
imm.hideSoftInputFromWindow(getWindow().getDecorView()
.getWindowToken(), 0);
}
本文提供了一段用于在Android应用中隐藏软键盘的代码示例。通过获取InputMethodManager服务并调用hideSoftInputFromWindow方法,可以有效地关闭当前活动窗口中的软键盘输入。
2625

被折叠的 条评论
为什么被折叠?



