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