Android EditText默认不弹出软件键盘

前言
         欢迎大家我分享和推荐好用的代码段~~
声明
         欢迎转载,但请保留文章原始出处:
         CSDN
http://www.csdn.net
         雨季o莫忧离:http://blog.csdn.net/luckkof

正文

 

方法一:
在 AndroidMainfest.xml中选择哪个activity,设置windowSoftInputMode属性为adjustUnspecified|stateHiddenjava代码:Java代码1.
android:label="@string/app_name"
android:windowSoftInputMode="adjustUnspecified|stateHidden"8.9.android:configChanges="orientation|keyboardHidden">

16.17.



方法二:
让EditText失去焦点,使用EditText的clearFocus方法
例如:EditText edit=(EditText)findViewById(R.id.edit);

edit.clearFocus();

方法三:
强制隐藏Android输入法窗口java代码:Java代码
EditTextedit=(EditText)findViewById(R.id.edit);2.3.4.
InputMethodManagerimm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);6.7.8.
imm.hideSoftInputFromWindow(edit.getWindowToken(),0);

你可能感兴趣的:(Android)