Android InputConnection:选择更改时收到通知

时间:2014-04-26 21:10:29

标签: android android-input-method

当光标位于句点(InputMethodService)和空格后,我希望我的'.'切换到大写字母。诀窍是在重新定位光标时得到通知。光标可能在一段时间后定位:

  1. 用户输入期间,或
  2. 用户触摸屏幕,或
  3. 用户粘贴一些文字。
  4. 问题:如何通知InputMethodService选择更改和文字粘贴?

1 个答案:

答案 0 :(得分:0)

InputMethodService.onUpdateSelection (int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd)可以解决问题。

您可以尝试在InputConnection中找到类似的内容(就像我一样),但是没有 InputConnection.getSelection() InputConnection.onSelectionChanged()

相关问题