android editText keyboard changed after setText()

不想你离开。 提交于 2019-12-12 03:48:21

问题


If I want to enter a message into an editText, I enter some digits and my keyboard looks like that:

but after I add some text from code by clicking the button (et.setText(et.getText().toString() + " " + "abc")), keyboard changes to:

is there a way to prevent this happening?


回答1:


I've used editable.append instead of et.setText() and this works




回答2:


You should set input type in your EditText (for example by using "android:inputType" in xml file containing the layout).

See: http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType



来源:https://stackoverflow.com/questions/10091390/android-edittext-keyboard-changed-after-settext

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