标签:android
editText.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) { // TODO Auto-generated method stub //s:变化后的所有字符 Toast.makeText(getApplicationContext(), "变化:"+s, Toast.LENGTH_SHORT).show(); } public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub //s:变化前的所有字符; start:字符开始的位置; count:变化前的总字节数;after:变化后的字节数 Toast.makeText(getApplicationContext(), "变化前:"+s+";"+start+";"+count+";"+after, Toast.LENGTH_SHORT).show(); } public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub //S:变化后的所有字符;start:字符起始的位置;before: 变化之前的总字节数;count:变化后的字节数 Toast.makeText(getApplicationContext(), "变化后:"+s+";"+start+";"+before+";"+count, Toast.LENGTH_SHORT).show(); } });
标签:android
原文地址:http://blog.csdn.net/anjon520/article/details/37996781