Attributes of Android edittext

Source: Internet
Author: User

Edittext inheritance relationship: View --> textview --> edittext.


Edittext has many attributes. Here we will introduce several attributes:

Android
: Layout_gravity = "center_vertical"

Set the display position of the control: Top by default. HereCenter
Show, and bottom


Android: hint = "enter a number! "

The settings are displayed onSpatial prompt information



Android: Numeric = "integer"

SetOnly integers can be entered.
In decimal format


Android: singleline = "true"

Set single-row input. Once set to trueText does not wrap automatically
.


Android: Password = "true"

SetOnly passwords can be entered



Android: textcolor = "# ff8c00"
Font color



Android: textstyle = "bold"
Font
, Bold, italic, bolditalic


Android: textsize = "20dip"
Size



Android: Capitalize = "characters"
Uppercase/lowercase letters



Android: textalign = "center"

Edittext does not have this attribute, but textview has,Center



Android: textcolorhighlight = "# cccccc"
Background Color of the selected text
, Blue by default


Android: textcolorhint = "# FFFF00"

SetText color of the prompt message
, Gray by default


Android: textscalex = "1.5"
Control the spacing between words



Android: Typeface = "monospace"
Font
, Normal, SANS, Serif, monospace


Android: Background = "@ null"
Spatial background
, Not here, it indicates transparent


Android: layout_weight = "1"
Weight
Controls the status between controls, which is very useful in the display of controls.


Android: textappearance = "? Android: ATTR/textappearancelargeinverse"
Text appearance

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.