我正在建立一個列表和列表包含每個聯繫人 複選框來選擇哪一個修改例如,問題是 當列表變得比手機屏幕長,滾動是 有效;當我選擇一個複選框時,第二個會自動在列表底部選擇 。自動選擇列表視圖中的複選框 - android
問題是自動選擇第二個複選框; 請讓我知道我該如何解決?
下面是代碼我使用getView方法
public View getView(int position, View converView, ViewGroup parent){
View row = converView;
if(row == null){
LayoutInflater inflater = getLayoutInflater();
row = inflater.inflate(R.layout.edit, parent, false);
}
TextView label = (TextView)row.findViewById(R.id.label);
label.setText(items[position]);
CheckBox cb = (CheckBox)row.findViewById(R.id.del);
ImageView icon = (ImageView)row.findViewById(R.id.icon);
icon.setImageResource(images.get(position));
Log.i("Pos", ""+position);
return row;
}
}
非常感謝你Julien,它的工作,我只是改變了一件事,我改變了布爾值[] itemChecked;到布爾值itemChecked [] = new boolean [100];因爲它給了我空指針異常... – Waqar 2010-09-13 20:51:10