Android EditText default numeric keyboard and allow text [duplicate]

泪湿孤枕 提交于 2019-12-05 22:21:29

问题


Possible Duplicate:
EditText with number keypad by default, but allowing alphabetic characters

Wondering if it is possible to default to a numeric keyboard on focus for an edittext field but also allow users to input characters? None of the input types seem to support this. Thanks!


回答1:


I just tried to add a number text field in Android and it ran in the emulator fine. It defaults to bring up the number pad first, but you can switch to characters just as easy. So try to use a number text field.

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:inputType="number" />


来源:https://stackoverflow.com/questions/9183260/android-edittext-default-numeric-keyboard-and-allow-text

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