监听EditText内容变化

1、给EditText追加ChangedListener

EditText editText = (EditText) findViewById(R.id.edittext);

editText.addTextChangedListener(watcher);

 

 

 

2、描述监听

private TextWatcher watcher = new TextWatcher() {
    
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
        // TODO Auto-generated method stub
        
    }
    
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count,
            int after) {
        // TODO Auto-generated method stub
        
    }
    
    @Override
    public void afterTextChanged(Editable s) {
        // TODO Auto-generated method stub
        
    }
};

posted @ 2010-08-06 10:47  sikaodelang  阅读(307)  评论(0编辑  收藏  举报