简体   繁体   English

软键盘 - 仅限数字

[英]Soft Keyboard - Numeric Only

my question is kinda related to this question: Numeric Soft Keyboard on Android 我的问题与这个问题有点关系: Android上的数字软键盘

BUT, the question above isnt answered, so here i am. 但是,上面的问题没有回答,所以我在这里。

Theres a EditText that when it gets touched or has focus, i want the Software Keyboard to show up by default as NUMERIC! 这是一个EditText,当它被触摸或有焦点时,我希望软件键盘默认显示为NUMERIC! Of course, you can switch back to ALPHANUMERIC, but i want to force it to show up as NUMERIC. 当然,您可以切换回ALPHANUMERIC,但我想强制它显示为NUMERIC。

Thanks guys 多谢你们

Use the android:inputType XML attribute with the number value: 使用带有number值的android:inputType XML属性:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM