//收键盘,比较有用的
private void hideInputMethodManager(View v) {
InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
不让弹键盘(例子)
getActivity().getCurrentFocus().clearFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
首次进入页面,不让弹键盘,(前面写到过了)
1. getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ STATE_ALWAYS_HIDDEN);
首次进入页面,想要弹出软键盘 onCreate(Bundle bd)加上
2.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);