Sample SoftKeyboard double letters

匿名 (未验证) 提交于 2019-12-03 08:57:35

问题:

I'm android's beginner developer , I downloaded source code for sample SoftKeyboard

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

First i had problem which is

"When Typing a letter/letters , and switching to Symbol Keyboard , and type a number , the previous letter/letters Typed is Removed"

i fixed it by removing else from method handleCharacter() in 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); } 

but now i have another problem......

When typing letter then press space or delete , This letter doubled(ex: a > aa).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!