在 ListView Footer 中的 Enter Click 监听器

我想在 listView 中设置一个 edit text,作为一个footer,那样的话我就能添加一个评论。我可以把edittext 添加到listview中,但是没有看到我设置的监听器。为什么啊?

    editText = new EditText(getActivity());
    editText.setHint("add comment");
    editText.setBackgroundColor(Color.GRAY);
    getListView().addFooterView(editText);
    editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
    editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            Log.d(DetailFragment.class.getSimpleName(), "pressed");
            return false;
        }
    });
    setListAdapter(commentAdapter);

添加:

editText.setSingleLine(true);

另外,我觉得你可以不使用 editText 作为 FooterView。把 editText 放在 parentBottom 中,添加 ListView。那样用户不用去 list 的末尾,就能评论了。