The situation is as follows: Android application. There is 1 EditText , ImageView (although there may be another view ), there is a button, when clicked, the keyboard appears. So, ideally, it is necessary that when you press the keyboard appearance button, besides calling the keyboard, the focus is removed, the input to EditText , the letters in EditText stop appearing, that they are processed by another method, and only when you click on EditText , the focus EditText on it, and and was processing EditText . For example, without EditText in my Activity everything is handled like this:

 @Override public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_UNKNOWN) { String s = event.getCharacters(); for (int i = 0; i < s.length(); ++i) sendChar(s.charAt((i))); } else { for (int i = 0; i < repeatCount; ++i) onKeyDown(keyCode, event); } return true; } 

But when I insert all the processing in the layout Activity EditText , the letters are simply displayed in the EditText .

    2 answers 2

    In the manifest

     android:windowSoftInputMode="stateHidden" 

    You can Edittext add in the Edittext itself:

     android:cursorVisible="false" 

    Third option, add to parent layout

     android:focusableInTouchMode="true" > 
    • no helps - Madoka Magica
    • @MadokaMagica added another option - McDaggen

    I do not know if I did it by stupid, but it seems to work, I put on EditText OnClickListener:

      etbrw.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { etbrw.setFocusable(true); etbrw.setFocusableInTouchMode(true); } }); 

    In the handler of a button or a picture, I just write:

     etbrw.setFocusable(false); touchpad.setFocusable(true); 

    Two clicks on editText and it is highlighted on. its handler. Clicking a button or a picture and the focus with edittext disappears, onKeyMultiple starts working