我是android的初学者,我下载了样本SoftKeyboard的源代码
https://android.googlesource.com/platform/development/+/android-2.3.3_r1.1/samples/SoftKeyboard
首先我遇到了问题
"当键入字母/字母,并切换到符号键盘,然后键入数字时,前一个字母/字母键入已删除"
我通过从else
handleCharacter()
移除SoftKeyboard.java
来解决此问题
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)。