我的活动中有 Gridview。我的 GridView 的数据适配器:
private class EfficientAdapter extends BaseAdapter {
...
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.item3, null);
holder = new ViewHolder();
holder.Attitude_Value = (EditText) convertView.findViewById(R.id.editText1);
holder.Attitude_Value.addTextChangedListener(new TextWatcher()
{
public void afterTextChanged(Editable edt)
{attitude_values.set(holder.ref, edt.toString());}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3){}
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {}});
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.ref=position;
holder.Attitude_Value.setText(attitude_values.get(position));
return convertView;
}
...
如何在开始输入之前清除网格视图中的编辑框,当我关注它时?