一.在Mainfext.xml相应的Activity中添加下列代码:
android:windowSoftInputMode="stateHidden"
二.在对应的Activity中或xml布局文件中,让EditText失去焦点:
Activity代码:
EditText edit = (EditText)findViewById(R.id.edit);
edit.clearFocus();
xml文件中:
android:focusable="false"
三.隐藏输入法窗口
EditText edit = (EditText)findViewById(R.id.edit);
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(), 0);