我想我已经接近了获取软键盘IME_ACTION_SEND的监听者。目标是执行另一个按钮的点击。它不显示在屏幕上的代码,但在源代码编辑器中,“OnEditorActionListener()”以红色下划线并给出错误:软键盘从EditText发送文本到程序
“新的TextView.OnEditorActionListener(){}类型必须实现继承了抽象方法TextView.OnEditorActionListener.onEditorAction(TextView,int,KeyEvent)“,我以为是。
“KeyEvent”关键字在编辑器中也是一个错误:“KeyEvent无法解析为某种类型”。
可能是我正在做的事情(或不做)。谢谢你的帮助。
et1.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND) {
calculateButton.performClick();
}
return true;
}
});