android EditText inputType for StreetNumber field

跟風遠走 提交于 2019-12-08 22:08:32

问题


I'm trying to choose correct inputType in my adress dialog streetNumber field. I want to show numeric keyboard first, but then let user also to input alphabetic characters for some very special cases. Closer to this is inputType datetime, but this doesn't allow to enter alphabetic characters. So how to set my streetNumber field correctly?


回答1:


Use android:inputType="textPostalAddress"




回答2:


The EditText inherits from TextView and shares its input type attributes with it. They can be found here in the official documentation.

Maybe the input type textPostalAddress would be suitable for your need. If not, plenty of other types are available. The XML attribute that allows setting this type is android:inputType="the type you have chosen".




回答3:


See if this can help you

myEditText.setRawInputType(Configuration.KEYBOARD_QWERTY)


来源:https://stackoverflow.com/questions/6828105/android-edittext-inputtype-for-streetnumber-field

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