wb8840
2017-07-24 03:04安卓开发,只能全选,不能选择某一行
/**
* 设置选中(没有多选框),有多选框的请使用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();
}
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- easyui datagrid 中怎么选中所有页面的数据,选中第一页全选,后面几百页数据全部选中
- javascript
- eclipse
- jquery
- 1个回答
- android的CheckBox点击全选信息反馈不正常,该如何解决?
- android-studio
- 1个回答
- 如何为表创建“全选”按钮
- html
- javascript
- button
- php
- 1个回答
- select多选下拉全选问题
- jquery
- 3个回答
- android recyclerview长按让所有item中的checkbox都显示
- android
- recyclerview长按处理
- recyclerview.adapter
- 3个回答
换一换