Android的默认的EditText数字键盘,让文字文字、数字键盘、Android、EditText

2023-09-06 13:54:35 作者:后来

可能重复:   EditText由默认的数字键盘,但允许字母

想知道是否可以默认为一个数字键盘上聚焦为一个EditText领域,而且允许用户输入字符?无输入类型似乎支持这一点。 谢谢!

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!

推荐答案

我只是想加入Android的一些文本字段,它运行在模拟器罚款。它默认为打开数字键盘第一,但你可以切换到文字一样简单。因此,尝试使用一些文本字段。

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" />