0

我的布局有一个 listView,其中包含一些可选的 textViews 和一个在 ListView 之外的 editText。如果 textView 处于焦点,则 softKeyboard 为 up 。如果 listView 中的任何一个 textViews 被 longpress 选择,我手动关闭 softKeyboard 。当布局调整所选文本的大小始终指向 listView 中的最后一个单元格并且使事情复杂化时,会出现问题,它将最后一个单元格复制到所选单元格的值。

关于选择:

 --aaa--
 --bbb--(selected)
 --ccc--
 ---editText--
 ---Keyboard--

After manually closing the keyboard :

---aaa--
---bbb--
---bbb--(selected and duplicated)
---editText--

有没有其他人遇到过这个问题?

编辑:

添加长按代码:

@Override
    public boolean onLongClick(View v) {
        InputMethodManager imm = (InputMethodManager).getSystemService(Context.INPUT_METHOD_SERVICE);
        if(null != imm)
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
        return false;  //Returning false on purpose to let the android system handle the event
    }
4

0 回答 0