示例SoftKeyboard双字母

我是android的初学者开发者,我下载了样本SoftKeyboard的源代码

https://android.googlesource.com/platform/development/+/android-2.3.3_r1.1/samples/SoftKeyboard

首先我有问题

“当键入字母/字母,并切换到符号键盘,并键入数字时,前一个字母/字母键入已删除”

我通过从handleCharacter()方法handleCharacter()中删除else来修复它

 private void handleCharacter(int primaryCode, int[] keyCodes) { if (isInputViewShown()) { if (mInputView.isShifted()) { primaryCode = Character.toUpperCase(primaryCode); } } if (isAlphabet(primaryCode) && mPredictionOn) { mComposing.append((char) primaryCode); getCurrentInputConnection().setComposingText(mComposing, 1); updateShiftKeyState(getCurrentInputEditorInfo()); updateCandidates(); } //The following line was moved out of the else clause getCurrentInputConnection().commitText( String.valueOf((char) primaryCode), 1); } 

但现在我有另一个问题……

键入字母然后按空格或删除,此字母加倍(例如:a> aa)。