一、Android EditText默认不弹出输入法的办法:
1. 在AndroidManifest.xml中将需要默认隐藏键盘的Activity中添加属性即可(常用此方法)
1
2
|
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
android:configChanges=
"orientation|keyboardHidden"
|
例如:
1
2
3
4
5
6
|
<activity
android:name=
".activity.CheckInfoActivity"
android:launchMode=
"singleTask"
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
android:configChanges=
"orientation|keyboardHidden"
android:screenOrientation=
"portrait"
/>
|
2. 让 EditText失去焦点,使用EditText的clearFocus方法
1
2
|
EditText edit = (EditText)findViewById(R.id.edit);
edit.clearFocus();
|
3. 强制隐藏Android输入法窗口
1
2
3
|
EditText edit=(EditText)findViewById(R.id.edit);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(),
0
);
|