Android EditText limits the input of some fixed character attributes, androidedittext

Source: Internet
Author: User

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.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.