软键盘 - 仅数字

发布于 2024-09-09 01:38:05 字数 244 浏览 1 评论 0原文

我的问题与这个问题有点相关: Android 上的数字软键盘

但是,问题上面没有回答,所以我在这里。

有一个 EditText,当它被触摸或获得焦点时,我希望软件键盘默认显示为数字!当然,您可以切换回字母数字,但我想强制它显示为数字。

谢谢大家

my question is kinda related to this question: Numeric Soft Keyboard on 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! Of course, you can switch back to ALPHANUMERIC, but i want to force it to show up as NUMERIC.

Thanks guys

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

于我来说 2024-09-16 01:38:05

使用 android:inputType 具有 number 值的 XML 属性:

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

Use the android:inputType XML attribute with the number value:

<EditText android:id="@+id/edtInput"
    android:layout_width="0dip"
    android:layout_height="wrap_content"
    android:inputType="number"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文