Edittext attributes
Edittext inheritance relationship: View --> textview --> edittext.
Edittext has many attributes.
Items:
Android: layout_gravity = "center_vertical"
Set the display position of the control: Default
Top, center shown here, and bottom
Android: hint = "enter a number! "
Set the prompt information displayed on the space
Android: Numeric = "integer"
Only integers can be entered. If decimal is used, decimal is used.
Android: singleline = "true"
Set single-line Input. Once set to true, the text will not wrap automatically.
Android: Password = "true"
Set
Set only passwords
Android: textcolor = "# ff8c00"
Font color
Android: textstyle = "bold"
Revenue collection
Font, bold, italic, bolditalic
Android: textsize = "20dip"
Large
Small
Android: Capitalize = "characters"
Uppercase/lowercase letters
Android: textalign = "center"
Edittext does not have this attribute, but textview has, center
Android: textcolorhighlight = "# cccccc"
The background color of the selected text. The default color is blue.
Android: textcolorhint = "# FFFF00"
Configuration Overview
The color of the text displayed in the information. The default value is gray.
Android: textscalex = "1.5"
Control the spacing between words
Android: Typeface = "monospace"
Font, normal, SANS, Serif, monospace
Android: Background = "@ null"
Space background. This field does not exist. It is transparent.
Android: layout_weight = "1"
Weight to control
Status, which is useful when the control is displayed.
Android: textappearance = "? Android: ATTR/textappearancelargeinverse"
Edittext always does not pop up the software keyboard
1. The edittext keyboard is not displayed by default.
Method 1:
In
Which activity is selected in androidmainfest. XML and the windowsoftinputmode attribute is
Adjustunspecified | statehidden
Example: <activity Android: Name = ". Main"
Android: Label = "@ string/app_name"
Android: windowsoftinputmode = "adjustunspecified | statehidden"
Android: configchanges = "orientation | keyboardhidden">
<Intent-filter>
<Action
Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter> hair style 123
</Activity>
Method 2:
Let
Edittext loses focus and uses the clearfocus method of edittext.
Example: edittext
Edit = (edittext) findviewbyid (R. Id. Edit );
Edit. clearfocus ();
Fang
Method 3:
Force hide Android Input Method window
Example: edittext
Edit = (edittext) findviewbyid (R. Id. Edit );
Inputmethodmanager Imm =
(Inputmethodmanager) getsystemservice (context. input_method_service );
Imm. hidesoftinputfromwindow (edit. getwindowtoken (), 0 );
2. edittext always does not bring up the software keyboard
Example: edittext
Edit = (edittext) findviewbyid (R. Id. Edit );
Edit. setinputtype (inputtype. type_null );