直接在删除的点击事件里加入以下代码即可:
int keyCode = KeyEvent.KEYCODE_DEL;
KeyEvent keyEventDown = new KeyEvent(KeyEvent.ACTION_DOWN, keyCode);
KeyEvent keyEventUp = new KeyEvent(KeyEvent.ACTION_UP, keyCode);
editText.onKeyDown(keyCode, keyEventDown);
editText.onKeyUp(keyCode, keyEventUp);
网友评论