Implicit “Submit” after hitting Done on the keyboard at the last EditText

前端 未结 10 611
无人及你
无人及你 2020-11-29 17:51

I\'ve used some apps where when I fill my username, then go to my password, if I hit \"Done\" on the keyboard, the login form is automatically submitted, without me having t

10条回答
  •  [愿得一人]
    2020-11-29 18:32

    
    
    
    

    in the java file

    EditText userNameField = (EditText) findViewById(R.id.signinscr_userName);
    EditText passwordField = (EditText) findViewById(R.id.signinscr_password);
    
    passwordField.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
            //Do your operation here.
            return false;
        }
    });
    

提交回复
热议问题