Android EditText改变状态为不可编辑但是可以点击

1.设置EditText为不可编辑状态 直接上代码:

        et_efunction_search_content?.inputType = View.AUTOFILL_TYPE_NONE
        et_efunction_search_content?.isFocusable = false
        et_efunction_search_content?.isCursorVisible = false

2.修改EditText为可编辑状态 直接上代码:

        et_efunction_search_content?.inputType = View.AUTOFILL_TYPE_TEXT
        et_efunction_search_content?.isFocusable = true
        et_efunction_search_content?.isCursorVisible = true
        et_efunction_search_content?.setOnClickListener(null)

3.首次进到页面默认获取到焦点并弹窗

        et_efunction_search_content.isFocusable = true
        et_efunction_search_content.isFocusableInTouchMode = true
        et_efunction_search_content.requestFocus()
        et_efunction_search_content.findFocus()
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)

你可能感兴趣的:(Android EditText改变状态为不可编辑但是可以点击)