I have a fragment with EditText used as search bar. What I wanna I do is when I press the back button to close the keyboard, which is opened when clicked on the EditText, is to disable the blinking cursor. For some reason when I'm handling the code below, the cursor still remains visible.
editText.setOnKeyListener{ _, keyCode, event ->
if(keyCode == KeyEvent.KEYCODE_BACK) {
editText.isCursorVisible = false
true
} else {
false
}
}
I've tried different methods, but none of them gave me the desired result. Am I missing something or is there another method for handling this?