直接在刪除的點擊事件里加入以下代碼即可:
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);