Restrict entering only certain values including numbers, letters, etc.
Android:digits= "0123456789ABCDEFGHIGKLMNOPQRSTUVWXYZ"
The above line of code can be any of your restrictions, you can only enter what is written on it, it is written only can enter numbers and letters.
Android:inputtype= "Textpassword" android:digits= "0123456789abcdefghigklmnopqrstuvwxyz"
Here is only the number and letter and the password format, the two settings do not conflict, android:inputtype= "Textpassword" Here is the text, can be entered in Chinese, but if you add android:digits= " 0123456789abcdefghigklmnopqrstuvwxyz ", InputType here the Chinese will be invalid, but password will not fail, here is just an analogy, we all understand.
Property value of InputType
Android:inputtype= "None" android:inputtype= "text" android:inputtype= "textcapcharacters" Letter Capital Android:inputtyp E= "Textcapwords" uppercase Android:inputtype= "Textcapsentences" only the first letter capitalized android:inputtype= "Textautocorrect" auto-complete and Roid:inputtype= "Textautocomplete" auto-complete android:inputtype= "textmultiline" multi-line input android:inputtype= "TextImeMultiLine" Input method Multiline (if supported) android:inputtype= "Textnosuggestions" does not prompt android:inputtype= "Texturi" url android:inputtype= "TextEmail Address "e-mail address android:inputtype=" textemailsubject "Mail subject android:inputtype=" Textshortmessage "SMS Android:inputty Pe= "textlongmessage" long message android:inputtype= "Textpersonname" name android:inputtype= "textpostaladdress" Address android:i nputtype= "Textpassword" Password android:inputtype= "Textvisiblepassword" Visible password android:inputtype= "TextWebEditText" as a Web Form Text android:inputtype= "TextFilter" Text filter filter android:inputtype= "textphonetic" Pinyin input//numeric type android:inputtype= "Number" Digital android:inputtype= "nUmbersigned "Signed number format android:inputtype=" numberdecimal "floating point format with decimal point android:inputtype=" phone "dial pad android:inputtype = "datetime" Time Date android:inputtype= "date" android:inputtype= "Time" keyboard
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android restrictions only enter certain values including numbers, letters, etc.