就这样
在 onBindHolder() 里面 对将要处理的 EditText 这样处理;
holder.mRouteView.mDestinationEt.setText(item.getDestination());
TextWatcher desWatcher =new NewWatcher() {
@Override
public void afterTextChanged(Editable s) {
if (holder.mRouteView.mDestinationEt.hasFocus()) {
if (mRouteListener !=null)
mRouteListener.getDestination(position, holder.mRouteView.mDestinationEt.getText().toString());
}
}
};
holder.mRouteView.mDestinationEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
holder.mRouteView.mDestinationEt.addTextChangedListener(desWatcher);
}else {
holder.mRouteView.mDestinationEt.removeTextChangedListener(desWatcher);
}
}
});
网友评论