我有一个带有编辑文本框和-/+按钮的列表视图。当我点击按钮时,会更改编辑文本框的值,就像增加/减少一样。
当我设置值为5并滚动列表视图时,编辑文本框的值会被设置为默认值0。
我是这样使用的:
public View getView(final int position, View convertView,ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View connection;
final ViewHolder holder;
connection = new View(context);
connection = inflater.inflate(R.layout.list_row_modified, null);
holder = new ViewHolder();
holder.up = (Button) connection.findViewById(R.id.btn_plus);
holder.down = (Button) connection.findViewById(R.id.btn_minus);
holder.date = (TextView) connection.findViewById(R.id.text_date);
//onClick with holder.up/holder.down
connection.setTag(holder);
return connection;
}