我正在使用android studio。我在我的片段页面中编辑文本,现在我想在单击EditText外部后隐藏键盘。我使用下面的代码,但它不工作。在碎片中隐藏EditText的键盘
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final InputMethodManager imm = (InputMethodManager)
getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(locationEt.getWindowToken(), 0);
}
由于提前
请尽量将外面或其他视图点击事件
像这样一个http://stackoverflow.com/questions/4165414/how-to-hide-soft-keyboard-on-android-after-clicking-outside-edittext –