Android EditText default numeric keyboard and allo

2019-04-07 06:00发布

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条回答
狗以群分
2楼-- · 2019-04-07 06:38

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" />
查看更多
登录 后发表回答