方法1:
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
if(imm != null && imm.isActive()){
imm.hideSoftInputFromWindow(editText.getApplicationWindowToken(), 0 );
}
if(imm.isActive()){
Log.e("error","自带系统键盘关闭失败");
}
正如后面检测的 亲测:无效—–内心是崩溃的
方法2:/**
* 屏蔽系统输入法
*/
// private void notSystemSoftInput() {
// if (Build.VERSION.SDK_INT <= 10) {
// editText.setInputType(InputType.TYPE_NULL);
// } else {
// ( (Activity)context).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
// try {
// Class<EditText> cls = EditText.class;
// Method setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
// setShowSoftInputOnFocus.setAccessible(true);
// setShowSoftInputOnFocus.invoke(this, false);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
这种方法是网上找的 亲测->无效
方法3;:
manifest中配置 windowSoftInputMode =”statehidden”
只是能做到屏幕开始不会激活
终极大招:绝对有效
edit.setinputtype=”inputtype.null”