Android EditText Properties Summary + Limited input some special characters

Source: Internet
Author: User

Found a lot of places did not see, after trying to find such a method can reach the limit edittext characters.

android:digits= "1234567890qwertyuiopasdfghjklzxcvbnm '-=[]\;,./[email protected]#$%^* () _+}{:?&< >"' "

Inside is the character that can be entered, everyone according to their own needs to add.

Take a copy of some of the other seniors ' posts and leave them for backup.

Android:layout_gravity= "Center_vertical"

Sets the location of the control's display: Default top, centered here, and bottom

Android:hint= "Please enter a number! "

Set up a message to display on space

Android:numeric= "Integer"

The setting can only enter integers, if it is a decimal: decimal

Android:singleline= "true"

Sets the single-line input, and once set to True, the text is not wrapped automatically.

Android:password= "true"

Set to enter password only

Android:textcolor = "#ff8c00"

Font Color

Android:textstyle= "Bold"

Font, bold, italic, Bolditalic

Android:textsize= "20dip"

Size

Android:capitalize = "Characters"

Write in uppercase letters

android:textalign= "Center"

EditText does not have this attribute, but TextView has

android:textcolorhighlight= "#cccccc"

The background of the selected text, which is blue by default

Android:textcolorhint= "#ffff00"

Sets the color of the message text, which is grayed out by default

android:textscalex= "1.5"

Control the spacing between words and words

Android:typeface= "Monospace"

Font, normal, sans, serif, monospace

Android:background= "@null"

Space background, not here, refers to transparent

android:layout_weight= "1"

Weights, which control the position between controls, are useful when controlling the size of the control display.

Android:textappearance= "? Android:attr/textappearancelargeinverse"

Text appearance, which refers to the system comes with a look,? Indicates whether the system has this appearance, otherwise the default appearance is used. I don't know if I understand that, right?

Implemented by edittext the relevant properties in the layout XML file:

1. The Password Box property android:password= "True" allows the EditText to be displayed automatically as an asterisk, and the content will be changed to * within 1 seconds.

2. Pure Digital android:numeric= "true" This allows the input method to automatically become a digital input keyboard, while allowing only 0-9 of the digital input

3. Allow only android:capitalize= "cwj1987" This allows only input cwj1987 to be accepted, generally for password Authentication//This one is wrong, in lieu of my beginning

Here are some of the extended style attributes

Android:editable= "false" setting EditText not editable

Android:singleline= "true" forces the input to be in a single line

Android:ellipsize= "End" automatically hides trailing overflow data, typically used for long lines of text that cannot be displayed all

We have any fun, easy to use, please let me know

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.