在EditText中设置On Editor Action Listener时,需要使用EditorInfo.IME_ACTION_DONE,而不是EditorInfo.IME_ACTION_SEND。 代码示例:
EditText editText = findViewById(R.id.editText);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { // 处理完成操作 return true; } return false; } });