TextWatcher参数理解

来源:互联网 发布:dede 修改服务器域名 编辑:程序博客网 时间:2024/06/16 08:13
class MyTextWatcher implements TextWatcher{            @Override          public void afterTextChanged(Editable s) {              // s是文本改变后的内容              Log.i("afterTextChanged", "afterTextChanged the text's length is "+etTest.length());              Log.i("afterTextChanged", "afterTextChanged the s is "+s.toString());              Log.i("afterTextChanged", "-------------------------------------");          }            @Override          public void beforeTextChanged(CharSequence s, int start, int count,                  int after) {              // s是文本改变前的内容              // start是文本改变操作后输入光标所在位置              // count删除内容时是删除字符的个数,增加内容时为0              // after增加内容时是增加字符的个数,删除内容时为0 ,改变后新的内容的数量            // 通过组件索引获得的text内容是改变前的              Log.i("beforeTextChanged", "beforeTextChanged the text's content is "+etTest.getText().toString());              Log.i("beforeTextChanged", "beforeTextChanged the text's length is "+etTest.length());              Log.i("beforeTextChanged", "beforeTextChanged the s is "+s);              Log.i("beforeTextChanged", "beforeTextChanged the start is "+start);              Log.i("beforeTextChanged", "beforeTextChanged the count is "+count);              Log.i("beforeTextChanged", "beforeTextChanged the after is "+after);              Log.i("beforeTextChanged", "-------------------------------------");          }            @Override          public void onTextChanged(CharSequence s, int start, int before,                  int count) {              // s是文本改变后的内容              // start是文本改变操作后输入光标所在位置              // count增加内容时是增加字符的个数,删除内容时为0              // before删除内容时是删除字符的个数,增加内容时为0,被改变的内容的数量            // 通过组件索引获得的text内容是改变后的              Log.i("onTextChanged", "onTextChanged the text's content is "+etTest.getText().toString());              Log.i("onTextChanged", "onTextChanged the text's length is "+etTest.length());              Log.i("onTextChanged", "onTextChanged the s is "+s);              Log.i("onTextChanged", "onTextChanged the start is "+start);              Log.i("onTextChanged", "onTextChanged the before is "+before);              Log.i("onTextChanged", "onTextChanged the count is "+count);              Log.i("onTextChanged", "-------------------------------------");          }                }  



0 0