2
我正在開發一個包含EditText
的Android應用程序。Android SetText更改鍵盤類型
我控制什麼是通過調用
et.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
String message = et.getText().toString();
if(s.toString().compareTo(before)!=0){
et.setText(message);
et.setSelection(et.getText().length());
}
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
before = et.getText().toString();
System.out.println("After");
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
System.out.println("ON");
}
});
在afterTextChanged功能寫在EDITTEXT我用et.setText("some Text");
的問題是,該文本更改鍵盤後也發生了變化,例如,如果symbol
鍵盤是打開並使用了setText,它會自動更改爲qwerty
。
我該如何解決這個問題?
請添加更多code.I嘗試這並得到「java.lang.StackOverflowError」 – hasanghaforian 2012-07-11 09:33:44
檢查編輯..我添加了更多代碼 – 2012-07-11 10:01:49
你想使用特殊鍵盤嗎? – hasanghaforian 2012-07-11 11:42:43