Android EditText默认不弹出输入法的实现方法

一、Android EditText默认不弹出输入法的办法:

1. 在AndroidManifest.xml中将需要默认隐藏键盘的Activity中添加属性即可(常用此方法)

android:windowSoftInputMode="adjustUnspecified|stateHidden"
android:configChanges="orientation|keyboardHidden"

例如:

2. 让 EditText失去焦点,使用EditText的clearFocus方法

EditText edit = (EditText)findViewById(R.id.edit);
edit.clearFocus();

3. 强制隐藏Android输入法窗口

EditText edit=(EditText)findViewById(R.id.edit);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(),0);

以上这篇Android EditText默认不弹出输入法的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

你可能感兴趣的:(Android EditText默认不弹出输入法的实现方法)