你没有给你的
Editext
你应该这样做
getView()
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null){
LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.list_row_items,null);
viewHolder = new ViewHolder();
viewHolder.editQty = convertView.findViewById(R.id.editQty);
viewHolder.editRate = convertView.findViewById(R.id.editRate);
viewHolder.txtRs = convertView.findViewById(R.id.txtRs);
convertView.setTag(viewHolder);
}else {
viewHolder = (ViewHolder)convertView.getTag();
}
String Qty =bean.get(position).Qty;
viewHolder.editQty.setText(Qty);
viewHolder.editQty.addTextChangedListener(new onEditTextchange(holder.editQty, position));
}
public class onEditTextchange implements TextWatcher {
EditText getvalue;
int pos;
public onEditTextchange(EditText getvalue, int position) {
this.getvalue = getvalue;
this.pos = position;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
ItemBean objBean = new ItemBean();
objBean.Qty = getvalue.getText().toString();
objBean.Rate = items.get(pos).question;
objBean.Total = items.get(pos).question_id;
bean.set(pos, objBean);
}
}
希望这会有帮助