屏蔽输入法、显示光标

    /**
     * 屏蔽输入法、显示光标
     */
    public void disableShowSoftInput() {  
        if (android.os.Build.VERSION.SDK_INT <= 10) {  
            editText.setInputType(InputType.TYPE_NULL);  
        } else {  
            Class<EditText> cls = EditText.class;  
            Method method;  
            try {  
                method = cls.getMethod("setShowSoftInputOnFocus", boolean.class);  
                method.setAccessible(true);  
                method.invoke(editText, false);  
            } catch (Exception e) {  
            }  

        }  
    } 

参考:Android之禁止Edittext弹出软键盘并且使光标正常显示

猜你喜欢

转载自blog.csdn.net/pxq10422/article/details/74567709