android---控件---EditText
属性部分1.滚动条(垂直) android:scrollbarsvertical2.单行显示 android:singleLinetrueandroid:maxLines13.设置-输入长度限制 android:maxLength34.设置-去除下划线 android:backgroundnull5.显示剧中 android gravitycenter实例部分1.动画效果-聚焦效果2.动画效果-带方框输入框3.获取聚焦 失去聚焦的颜色效果4.事件-更改(addTextChangedListener)5.事件-内容更改事件------------------------------------------------------------------------------实例部分例实1.动画效果-聚焦效果EditText android:idid/sys_devicecalibrat_et_standard_value_y1 android:layout_width0dp android:layout_heightwrap_content android:layout_weight1android:backgroundandroid:drawable/editbox_backgroundandroid:gravitycenter android:hintY1 android:inputTypenumberDecimal android:padding8dp android:maxLength6 android:textSizedimen/fontsize_20sp/深挖 android:backgroundandroid:drawable/editbox_background框架内自带的2.动画效果-带方框输入框根据实例1.动画效果-聚焦效果的启发直接将android:backgroundandroid:drawable/editbox_background_normal即可。3.获取聚焦 失去聚焦的颜色效果在res-drawble-鼠标右键Drawble Resouse file点击新建名称edittext_fouused.xmlselector xmlns:androidhttp://schemas.android.com/apk/res/androiditem android:state_focusedtrue android:color#f60/item //获取聚焦颜色item android:state_focusedfalse android:color#0a0/item //失去聚焦颜色/selector//-------------------------------------EditTextandroid:idid/t1android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:textColordrawable/edittext_focused//edittext_fouused.xmlandroid:text微信 群聊 /4.事件-更改(addTextChangedListener)et_showscancontext.addTextChangedListener(new TextWatcher() {Overridepublic void beforeTextChanged(CharSequence s, int start, int count, int after) {}Overridepublic void onTextChanged(CharSequence s, int start, int before, int count) {}Overridepublic void afterTextChanged(Editable s) {String str et_showscancontext.getText().toString();}}});5.事件-内容更改事件editText.addTextChangedListener(new TextWatcher() { //内容更改事件public void beforeTextChanged(CharSequence s, int start, int count, int after) {}public void onTextChanged(CharSequence s, int start, int before, int count{}public void afterTextChanged(Editable s) {}});