1、EditText 使用中,点击(自动获取焦点)后软键盘无法唤出:
添加
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
或者把继承AlertDialog换为Dialog。
软键盘search型监听:
if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
//进行搜索操作的方法,
String keyword = search.getText().toString().trim();
if (CommonUtils.isAvailable(keyword)) {
listener.onSearch(keyword);
}
// 先隐藏键盘
((InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(v.getWindowToken(), 0);
return true;
}
本文详细介绍了在Android开发中遇到的EditText控件自动获取焦点后软键盘无法弹出的问题及解决方案,包括修改窗口属性和监听搜索操作的具体实现。
1657

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



