/**
* 设置选中(没有多选框),有多选框的请使用multiCheckedSelect方法
* @param selectPosition
*/
public void select(int selectPosition){
mSelectPosition = selectPosition;
notifyDataSetChanged();
}
/**
* 设置选中(有多选框)
* @param selectPosition
* @param view
*/
public void multiCheckedSelect(int selectPosition, View view) {
mSelectPosition = selectPosition;
if(mTableRow.isShowChecked() && selectPosition >= 0 && view != null && !mLoadHeadFromXml){
CheckBox cb = ViewHolder.get(view, R.id.cb);
cb.toggle();
boolean isChecked = cb.isChecked();
mCheckedMap.put(selectPosition, isChecked);
int columnIndex = mTableRow.isShowRownum() ? 2 : 0;
CheckBox headCb =(CheckBox)mHead.getChildAt(columnIndex);
if(isChecked){
mCheckedNum++;
if(!headCb.isChecked() && mCheckedNum == getCount()){
headCb.setChecked(true);
}
}else{
mCheckedNum--;
if(headCb.isChecked()){
headCb.setChecked(false);
}
}
}
notifyDataSetChanged();
}