Android imeOptions=“actionDone” not working

前端 未结 8 2087
无人及你
无人及你 2020-12-16 09:14

I am trying to get a login screen for an Android app and so far this is my code:



        
8条回答
  •  感动是毒
    2020-12-16 09:37

    You should set OnEditorActionListener for the EditText to implement the action you want to perform when user clicks the "Done" in keyboard.

    Thus, you need to write some code like:

    password.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                // Do whatever you want here
                return true;
            }
            return false;
        }
    });
    

    See the tutorial at android developer site

提交回复
热议问题