Android InputMethodService键滑动语言更改

时间:2015-03-31 14:36:17

标签: android localization android-softkeyboard android-input-method

我制作了一个带有InputMethodService的Android自定义键盘应用 现在我想在space key上滑动,因此当用户滑动space key时,键盘语言会更改为下一个(向右滑动)或向上滑动(向左滑动)。

public class CustomKeyboard extends Keyboard{...}  

public class CustomKeyboardView extends KeyboardView{...}

public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...}

有人可以帮我解决这个问题吗?

谢谢。

1 个答案:

答案 0 :(得分:2)

您无法使用键盘视图。或者更确切地说,这将是非常困难的。您几乎需要子类化KeyboardView并覆盖触摸处理程序,自己实现手势检测和命中检测。这就是为什么没有真正的键盘实际上使用KeyboardView(甚至不是谷歌的默认键盘),他们都制作自定义视图。 KeyboardView实际上只适用于简单事物的快速测试,如新的键布局或新的预测引擎。