我用 InputMethodService
制作了一个 Android 自定义键盘应用程序。
现在我想在 space key
上滑动,所以当用户滑动 space key
时,键盘语言会更改为下一个(向右滑动)或上一个(向左滑动)。
public class CustomKeyboard extends Keyboard{...}
public class CustomKeyboardView extends KeyboardView{...}
public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...}
有人可以帮我解决这个问题吗?
谢谢。
最佳答案
您不能使用键盘 View 。或者说,这将是极其困难的。您几乎需要子类化 KeyboardView 并覆盖触摸处理程序,自己实现手势检测和点击检测。这就是为什么没有真正的键盘实际使用 KeyboardView(甚至不是 Google 的默认键盘),它们都制作自定义 View 。 KeyboardView 实际上只适用于快速测试新的按键布局或新的预测引擎等简单事物。
关于Android InputMethodService 按键滑动语言更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29371261/