OnEditorActionListener代码

OnEditorActionListener代码

本文介绍了OnEditorActionListener代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使此代码正常工作.它已发布为检测软键盘上完成"或下一步"按钮的解决方案,但出现错误必须实现继承的抽象方法..onEditorAction ..".

I'm trying to get this code working. It has been posted as a solution to detecting the "done" or "next" button on a softkeyboard but I get the error "must implement inherited abstract method..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;

    });

推荐答案

您必须@Override该方法才能正确执行.

You have to @Override the method for proper execution.

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;

});

这应该有效.

这篇关于OnEditorActionListener代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 08:20