Android 在 EditText 上更改输入键以提交 Butterknife

Android on EditText change enter key for submit Butterknife

我正在使用 Butterknife 并尝试在 EditText 上更改提交的输入

<EditText
android:id="@+id/id_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gray_line_background"
android:ems="10"
android:gravity="top"
android:inputType="textMultiLine"
android:minLines="8" />

在我的片段中

@InjectView(R.id.id_message)
@NotEmpty(messageResId = R.string.err_message_empty)
EditText message;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_myfragment, container, false);
      ButterKnife.inject(this, v);

      validator = new Validator(this);
      validator.setValidationListener(this);

      message.setImeActionLabel("Submit", KeyEvent.KEYCODE_ENTER);

      message.setOnEditorActionListener(new EditText.OnEditorActionListener() {
          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
              if (actionId == EditorInfo.IME_ACTION_DONE) {
                  onNextClick(message);
                  return true;
              }
              return false;
          }
      });


    return v;
}

按钮不更改文本和侦听器不执行操作这两个都不起作用

谢谢

问题不在 ButterKnife,问题出在 xml

android:inputType="textMultiLine"

那一行没有改变输入,所以我以编程方式管理并工作

@InjectView(R.id.id_message)
@NotEmpty(messageResId = R.string.err_message_empty)
EditText message;

    @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_preclass3, container, false);
    ButterKnife.inject(this, v);

    message.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    message.setImeActionLabel("Enviar", EditorInfo.IME_ACTION_DONE);
    message.setImeOptions(EditorInfo.IME_ACTION_DONE);
    message.setLines(8);

    message.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onNextClick(message);
                handled = true;
            }
            return handled;
        }
    });


    return v;
}

谢谢