private List list;
// 加载的状态
private int loadState = LOADING;
// 两种view的类型
private static final int ITEM_VIEW = 1;
private static final int FOOTER_VIEW = 2;
// 底部视图的两种方式-加载更多 和 没有更多数据了
private static final int LOADING = 3;
private static final int NO_MORE = 4;
private boolean isChecked;
private Map<Integer,Boolean> map=new HashMap<Integer,Boolean>();
public MyAdapter(Context context, List list) {
this.context = context;
this.list = list;
}
/*
- 获得相应位置视图的类型
*/
@Override
public int getItemViewType(int position) {
// TODO Auto-generated method stub
if (position + 1 == getItemCount()) {
//底部视图
return FOOTER_VIEW;
} else {
//条目试图
return ITEM_VIEW;
}
}
/*
- 设置适配器加载的状态(加载更多和没有更多)
*/
public void setloadState(int state) {
this.loadState = state;
notifyDataSetChanged();
}
@Override
public int getItemCount() {
// TODO Auto-generated method stub
return list.size() + 1;
}
@Override
public void onBindViewHolder(ViewHolder holder, final int pos) {
// TODO Auto-generated method stub
if (holder instanceof ItemHolder) {
((ItemHolder) holder).mtv.setText(list.get(pos));
final Integer tag=new Integer(pos);
((ItemHolder) holder).mcb.setTag(tag);
if(map.containsKey(tag)){