方法一:
①int inputType = eidtText.getInputType();//保存当前键盘状态
②设置editText.setInputType(InputType.TYPE_NULL);//禁用手机软盘
③editText.setInputType(inputType);//还原输入类型
这种方法会隐藏软盘,但是却会导致光标无法显示,如果要显示光标,那就要使用另一种方法。
方法二:
eidtText.setShowSoftInputOnFocus(false);//api19以上