如何制作删除键-在自定义Android键盘中删除所有选定的编辑文本 [英] How to make delete key- delete all selected edit text in custom android keyboard
问题描述
我正在创建自定义的android键盘,并且如果要选择所有编辑文本,我想使用Delete键删除所有编辑文本.
I am creating custom android keyboard and I want delete key to delete all the edit text if they are selected.
即,当选择文本,剪贴板(剪切,复制,粘贴出现);在该模式下,如果按Delete键,则应全部删除.目前不是.
i.e, when text is selected, clipboard(cut,copy,paste comes up); in that mode , if the delete key is pressed, it should delete all. It doesn't currently.
P.S不会告诉我特定的编辑文本,它是自定义键盘,它无权编辑文本.
P.S don't tell me for a specific edit text, it is a custom keyboard, it won't have access to edit text.
推荐答案
我不明白为什么不会.在我创建的键盘中,我只是发送了删除键事件,它的作用就像一个超级按钮.选择某项后按Delete/Backspace键时,请尝试以下操作.
I don't see why it won't. In the keyboard, I created, I just send out the delete key event and it works like a charm. Try the following when delete/backspace key is pressed while something is selected.
getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_DEL));
getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,KeyEvent.KEYCODE_DEL));
这篇关于如何制作删除键-在自定义Android键盘中删除所有选定的编辑文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!