简体   繁体   English

在 android 工作室的 EditText 上使用数字键盘

[英]Using numeric keyboard on EditText in android studio

I'm using an EditText in my android app, and I want a numeric keyboard to show when I tap and try to edit it.我在我的 android 应用程序中使用 EditText,我希望在点击并尝试编辑它时显示数字键盘。

There are two easy ways to do it, add one of the following to EditText block in XML file:有两种简单的方法可以做到这一点,将以下之一添加到 XML 文件中的 EditText 块:

  1. To get a Numeric dial keyboard pad获取数字拨号键盘
        android:inputType="phone"
        android:digits="1234567890"
  1. To get the Numeric section of keyboard获取键盘的数字部分
        android:inputType="number"

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

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