标签:style os io ar for art cti sp log
实例一:
phone_view.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {});
实例二:
etSearch = (EditText)findViewById(R.id.etSearch);
etSearch.addTextChangedListener(searchWatcher);
TextWatcher searchWatcher = new TextWatcher() {
@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
if(chatHistoryAdapter != null){
chatHistoryAdapter.getFilter().filter(arg0);
}
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
}
@Override
public void afterTextChanged(Editable arg0) {
}
};
实例三:
editText1 = (EditText) findViewById(R.id.lin_search_edit);
editText1.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable edit) {
if (adapter != null) {
adapter.getFilter().filter(edit);
}
}
@Override
public void beforeTextChanged(CharSequence charsequence, int i,int j, int k) {
}
@Override
public void onTextChanged(CharSequence charsequence, int i, int j,int k) {
}
});
实例四:
// 搜索的监听
edit_input.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if(adapter!=null)
{
adapter.getFilter().filter(s);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
};
});
实例五:
editText1.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable edit) {
if (adapter != null && isNeedFilter) {
adapter.getFilter().filter(edit);// Adapter类中实现Filterable方法,并且重写getFilter()
}
}
@Override
public void beforeTextChanged(CharSequence charsequence, int i,
int j, int k) {
}
@Override
public void onTextChanged(CharSequence charsequence, int i, int j,
int k) {
}
});
实例六:
meetingReplyMsg.addTextChangedListener(textWatcher);
/**
* TextWatcher
*/
TextWatcher textWatcher = new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
System.out.println("---s.toString()---:" + s.toString());
if (!Utils.isStrEmpty(s.toString())) {
Config._reply_msg.set(s.toString().trim());
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
};
实例七:
mEdPhone.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
if (s.toString().length() > 0) {
mBtnRegister.setClickable(true);
mBtnRegister.setBackgroundResource(R.drawable.loginbtn);
} else if (s.toString().length() == 0) {
mBtnRegister.setClickable(false);
mBtnRegister
.setBackgroundResource(R.drawable.button_no_cliable);
}
mPhoneNumber = mEdPhone.getText().toString().trim();
}
});
实例八:
editText1.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable edit) {
if (adapter != null) {
adapter.getFilter().filter(edit);
}
}
@Override
public void beforeTextChanged(CharSequence charsequence, int i,
int j, int k) {
}
@Override
public void onTextChanged(CharSequence charsequence, int i, int j,
int k) {
}
});
实例九:
// 获取编辑框焦点
editText.setFocusable(true);
editText.addTextChangedListener(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
editText.setSelection(s.length());
Log.v("CustomDialog", "666666"+s.length());
}
});
实例十:
searchBox = (EditText) view.findViewById(R.id.com_facebook_picker_search_text);
searchBox.addTextChangedListener(new SearchTextWatcher());
if (!TextUtils.isEmpty(searchText)) {
searchBox.setText(searchText);
}
private class SearchTextWatcher implements TextWatcher {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
onSearchBoxTextChanged(s.toString(), false);
}
@Override
public void afterTextChanged(Editable s) {
}
}
标签:style os io ar for art cti sp log
原文地址:http://blog.csdn.net/tw19811220/article/details/39128023