EditText에서 엔터키를 누르면 button에서 설정한 이벤트가 실행되는 리스너.

1
2
3
4
5
6
7
8
9
10
  EditTextName.setOnEditorActionListener(new EditText.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    ButtonName.performClick();
                    return true;
                }
                return false;
            }
        });
 
cs

 

 

+ Recent posts