【发布时间】:2014-05-23 22:33:34
【问题描述】:
我在列表视图中遇到两个问题
当我在编辑文本和滚动列表视图上输入值时,编辑文本自动为空。
编辑文本不为空时,单击保存草稿按钮时无法获取所有列表视图行信息,非空编辑文本可能是一个或多个。
这里是我的列表视图适配器代码
class CreateAdapter extends ArrayAdapter<String> {
TextView txtItecode, txtItem;
EditText editQuantity;
String[] strItecode;
String[] strItem;
String[] strQuantity;
Context context;
CreateAdapter(Context context, String[] strItemcode, String[] strItem,
String[] strQauntity) {
super(context, R.layout.create_list_item, R.id.txtItemcode, strItemcode);
this.context = context;
this.strItecode = strItemcode;
this.strItem = strItem;
this.strQuantity = strQauntity;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View row = mInflater.inflate(R.layout.create_list_item, parent, false);
txtItecode = (TextView) row.findViewById(R.id.txtItemcode);
txtItem = (TextView) row.findViewById(R.id.txtItem);
editQuantity = (EditText) row.findViewById(R.id.editcreateQuantity);
txtItecode.setText(strItecode[position]);
txtItem.setText(strItem[position]);
editQuantity.setText(strQuantity[position]);
return row;
}
}
我是 Android 开发新手 请帮助我如何解决这个问题。
这两天一直在努力
【问题讨论】:
-
您尚未在适配器中设置编辑文本。
标签: android listview android-listview android-custom-view