我有两个 gridView、两个 ArrayList 数据和两个不同的 ArrayAdapter,但为什么我看到它们的数据相同 - “2”?
data1.add("1");
ArrayAdapter<String> listAdapter1 = new ArrayAdapter<String>(this, R.layout.item3, R.id.editText1, data1) {
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item3, null);
}
final String theData = getItem(position);
final EditText editText = (EditText) convertView.findViewById(R.id.editText1);
editText.setText(theData);
editText.addTextChangedListener(new MyTextWatcher(position));
return convertView;
}
};
gvMain1.setAdapter(listAdapter1);
data2.add("2");
ArrayAdapter<String> listAdapter2 = new ArrayAdapter<String>(this, R.layout.item3, R.id.editText1, data2) {
@Override
public View getView(final int position, View convertView, ViewGroup parent){
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item3, null);
}
final String theData = getItem(position);
final EditText editText = (EditText) convertView.findViewById(R.id.editText1);
editText.setText(theData);
editText.addTextChangedListener(new MyTextWatcher(position));
return convertView;
}
};
gvMain2.setAdapter(listAdapter2);