我正在努力让这段代码正常运行。它被发布作为检测软键盘上的“完成”或“下一步”按钮的解决方案,但我得到错误“必须实现继承的抽象方法..onEditorAction ..”
import android.widget.TextView.OnEditorActionListener;
textEdit5.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView arg0, int keycode, KeyEvent event) {
if(arg1 == KeyEvent.FLAG_EDITOR_ACTION){
btnSave.requestFocus();
return true;
}
return false;
});
答案 0 :(得分:1)
您必须@Override
方法才能正确执行。
textEdit5.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView arg0, int keycode, KeyEvent event) {
if(arg1 == KeyEvent.FLAG_EDITOR_ACTION){
btnSave.requestFocus();
return true;
}
return false;
});
这应该有用。