【文件属性】:
文件名称:FormEditText文本验证提示
文件大小:1.17MB
文件格式:RAR
更新时间:2018-06-15 15:34:44
安卓文本验证
In your xml import an extra namespace on the root of your layout
....
....
Note: It's not mandatory to use it on the root element. Also remember to change the xmlns value with your package name
Whenever you need to use the FormEditText just do the following in your xml.
As you noticed there is a whatever:test attribute setted to alpha. This let the FormEditText know that the data inside it should be only Alpha characters.
There are several values you can set to the test attribute:
regexp: for custom regexp
numeric: for an only numeric field
alpha: for an alpha only field
alphaNumeric: guess what?
personName: checks if the entered text is a person first or last name.
personFullName: checks if the entered value is a complete full name.
email: checks that the field is a valid email
creditCard: checks that the field contains a valid credit card using Luhn Algorithm
phone: checks that the field contains a valid phone number
domainName: checks that field contains a valid domain name ( always passes the test in API Level < 8 )
ipAddress: checks that the field contains a valid ip address
webUrl: checks that the field contains a valid url ( always passes the test in API Level < 8 )
date: checks that the field is a valid date/datetime format ( if customFormat is set, checks with customFormat )
nocheck: It does not check anything except the emptyness of the field.
For most of the test type values this library comes with a couple of default strings. This means that error strings ( english only ) are already available for the following test types: numeric, alpha, alphanumeric
You can customize them using the attributes
testErrorString used when the field does not pass the test
emptyErrorString used when the field is empty