Android EditText input box is not focused, click to jump

Requirements : Clicking the input box does not pop up the keyboard, does not focus, and directly jumps to the target interface 

Method 1: Set editText.isFocusable = false in the input box

mBinding.homeSearch.isFocusable = false
mBinding.homeSearch.setOnClickListener {
            val intent = Intent(requireActivity(), SearchHistoryActivity::class.java)
            startActivity(intent)
        }

Method 2 : Since the input box does not need to be input, just write a fake input box, for example, write a linear layout, add some icons in it, prompt copywriting, and add a click event.

 

Very simple, just a personal summary

Guess you like

Origin blog.csdn.net/LoveFHM/article/details/130124227