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)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章