Android EditText limits the input of some fixed character attributes, androidedittext
Android: digits = "abcdefghijklmnopqrstuvwxyz1234567890"
Only
How can I limit the number of characters in android EditText?
Only input is required. Generally, if you only specify the size of the input number, it can be used directly in the layout.
Android: inputType = "number" // You can select a pure number, mobile phone number, or email address.
Android: maxLength = "11" // This is the maximum input string length.
To set the minimum number of characters, you must use edittext. getText (). toString (). length in the code to get the length of the string,
If (edittext. getText (). toString (). length <6 ){
// Prompt that the character length entered by the user is insufficient. You can use TOAST or DIALOG
}
How can I limit the number of characters in android EditText?
EditText inherits from TextView and can use TextView attributes.