Yes, it is possible:
editText = (EditText) findViewById(R.id.edit_text);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
// do your stuff here
}
return false;
}
});
Note that you will have to import the following libraries:
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.widget.TextView;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…