1 回答
TA贡献1796条经验 获得超4个赞
只需更改以下方法并检查其工作与否!
@Override
public View getChildView(int groupPosition, int childPosition, boolean
isLastChild, View convertView, ViewGroup parent) {
if(convertView == null)
{
convertView = LayoutInflater.from(context).inflate(R.layout.list_row_child,null);
childViewHolder = new ChildViewHolder(convertView, groupPosition, childPosition);
convertView.setTag(childViewHolder);
}
else{
childViewHolder = (ChildViewHolder) convertView.getTag();
}
childViewHolder.childTitle.setText(groupItem.get(groupPosition)
.getChildTitles().get(childPosition));
return convertView;
}
另一个变化是
private class ChildViewHolder {
public TextView childTitle;
public EditText et;
public ChildViewHolder(View itemView, int groupPosition, int childPosition) {
super(itemView);
childTitle = itemView.findViewById(R.id.textViewChild);
et = itemView.findViewById(R.id.productCount);
et.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
if(charSequence != null){
groupItem.get(groupPosition).getArrayList().get(childPosition).setValue(charSequence.toString());
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
}
}
添加回答
举报