软键盘的有关设置

软键盘的相关设置

Manifest里边设置

 

//设置为隐藏的
<activity android:name=".xxxactivity"
		android:windowSoftInputMode="adjustUnspecified|stateHidden" />

//设置为一直展示的

<activity android:name=".EditPersonalInfoPage"
			android:windowSoftInputMode="stateAlwaysVisible|adjustResize" />

 


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

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

强制隐藏Android输入法窗口

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

EditText始终不弹出软件键盘

EditText edit=(EditText)findViewById(R.id.edit);
edit.setInputType(InputType.TYPE_NULL);