cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton,boolean b) {
}
});
et.addTextChangedListener( TextWatcher() {
@Override
void beforeTextChanged(CharSequence charSequence,1)">int i,1)">int i1,1)">int i2) {
}
@Override
void onTextChanged(CharSequence charSequence,1)"> i2) {
}
@Override
void afterTextChanged(Editable editable) {
}
});
myViewHolder.et.setOnFocusChangeListener( View.OnFocusChangeListener() {
@Override
void onFocusChange(View view,1)"> b) {
if (!b&&data.size()>position&&!myViewHolder.et.getText().toString().equals(data.get(position).getCheckValue()+"")) {
saveCheckValue(myViewHolder,position);//此方式实现将输入框数据填充到 data 数据集合中,无其他操作 即 data.get(position).setCheckValue(myViewHolder.et.getText().toString());
}
}
});
myViewHolder.et.setOnKeyListener( View.OnKeyListener() {
@Override
boolean onKey(View view,1)"> i,KeyEvent keyEvent) {
if (data.size()>position&&!myViewHolder.et.getText().toString().equals(data.get(position).getCheckValue()+"")) {
if (i == KeyEvent.KEYCODE_ENTER && keyEvent.getAction() == KeyEvent.ACTION_UP) {
saveCheckValue(myViewHolder,position);
}
}
return false;返回 false 让此方法可进行其他操作,如,把光标切换到下一个输入框
}
});wujiaox