/** * 关闭系统软键盘 */ private void closeKeyboard(EditText et) { // TODO Auto-generated method stub if (android.os.Build.VERSION.SDK_INT <= 10) { tv.setInputType(InputType.TYPE_NULL); } else { getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); try { Class<EditText> cls = EditText.class; Method setShowSoftInputOnFocus; setShowSoftInputOnFocus = cls.getMethod( "setShowSoftInputOnFocus", boolean.class); setShowSoftInputOnFocus.setAccessible(true); setShowSoftInputOnFocus.invoke(et, false); } catch (Exception e) { e.printStackTrace(); } } }
时间: 2024-10-12 04:42:25