我现在做的输入法为我的问题服务,当我触摸一个键时,如何用键改变文本。我已经有了如下的排列:
String [] textDynamic = new String[] { "a", "b" ,"i", "c" .....}这个数组加载当我触摸键盘上的任何键时,所有文本都会出现在我的键盘键中。
发布于 2015-12-11 13:07:45
在提交当前密钥后,必须在onKey()方法中使用此代码。
@Override
public void onKey(int primaryCode, int[] ints) {
-----
-----
conn.commitText(String.valueOf(code), 1);
List<Keyboard.Key> keys = kv.getKeyboard().getKeys();
for (Keyboard.Key key : keys) {
// you can set any codes & labels to the all the keys in this loop
// this is just an example of how it's done...
key.codes = new int[]{12, 13, 14};
key.label = "P";
}
-----
-----
}如果一个键只有一个字符,代码数组将只有一个int。
您可以将其与逻辑合并,以便从数组中生成随机密钥。
希望这能有所帮助。
https://stackoverflow.com/questions/32002684
复制相似问题