如何验证EditText仅在Android中处理数字? [英] How To Validate an EditText to handle numbers only in Android?

查看:88
本文介绍了如何验证EditText仅在Android中处理数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证android中的文本视图以处理正整数?

How can I validate a text view in android to handle positive integer numbers?

我不希望它接受任何字符或符号等.

I don't want it to accept any character or signs etc...

推荐答案

您是否看过EditText的

Have you taken a look at the EditText's inputType attribute? You can set a whole bunch of different input types that the EditText should limit the user input to.

从声音上看,您可能正在寻找类似的东西:

From the sounds of it, you're probably looking for something like:

<EditText
    ....
    android:inputType="number" 
     ... />

这篇关于如何验证EditText仅在Android中处理数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆