How to make sure that when you open an Activity in the EditText field there is no cursor (the field becomes active by default), but it should appear when the user EditText on this EditText .

And what event is responsible for the loss of focus, so that when you click outside of EditText I would remove the cursor from EditText and hide the keyboard?

  • In one question it is recommended to solve no more than one problem. For the ideas of "And how can I do more of this .." ask a new question. This is not your personal consultation, but a knowledge base and solutions to specific problems. - pavlofff

1 answer 1

After all, there is a method for changing the visibility of the cursor.

 editText.setCursorVisible(); 
  • Thank you, and what event is responsible for the loss of focus (so that when I click on an empty place of Activity, I remove the cursor from EditText and hide the keyboard)? - Vlad Lynnik
  • so that when I click outside EditText, I remove the cursor from EditText and hide the keyboard - Vlad Lynnik
  • @VladLynnik, InputMethodManager imm = (InputMethodManager) getSystemService (Context.INPUT_METHOD_SERVICE); The imm.isActive () method will return the keyboard state. And the setFocusable method of your EditText will remove focus from it. - Horoko
  • stackoverflow.com/questions/1109022/… Perhaps you will find more information here. - Horoko
  • Hide the keyboard by tapping on the screen, you can listen to MotionEvent events. - Horoko