I have a hidden EditText in my Activity. When you press a button, it appears.
1. How to make the keyboard immediately appear when it appears?
2. How to make it so that when you click anywhere (except for the button on which it appears) it hides?
|
3 answers
editTxt.requestFocus();
- OnTouchListener For all views, install this handler, check where we clicked and hide if necessary. Hide like a show.
|
1) In general, if InputType is set, then the keyboard is automatically displayed and usually the other way around is often the problem of how to hide it. Anyway, try this
InputMethodManager inputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
2) It is necessary to catch Activity.onTouchEvent()
- just not to be confused with View.onTouchEvent()
! And call EditText.setVisibility()
|
- how to hide the clav - there was a question and in general it was easy to find the answer
- to get out right away - call it when you press a button
- hang the listener on all assets and hide it with clave
|