如何捕捉"完成"从软键盘按键preSS按键、键盘、QUOT、preSS

2023-09-12 09:32:29 作者:我比较没用

我怎么赶在软键盘的特定按键事件? 特别是我很感兴趣的完成键。

how do I catch specific key events from the soft keyboard? specifically I'm interested in the "Done" key.

谢谢, 大利

推荐答案

您捕捉的KeyEvent,然后检查其关键code。 FLAG_EDITOR_ACTION用于识别从它们一个IME的输入键已被自动标记的未来输入键下一个或完成

You catch the KeyEvent and then check its keycode. FLAG_EDITOR_ACTION is used to identify enter keys that are coming from an IME whose enter key has been auto-labelled "next" or "done"

if (event.getKeyCode() == KeyEvent.FLAG_EDITOR_ACTION)
    //your code here

查找文档这里。

 
精彩推荐
图片推荐