我的大的listView 套着小的listView+textView class ParentsAdapter extends BaseAdapter {
//大的 适配器
List<SyncBean> syncBeans=new ArrayList<SyncBean>();
View viewChild = null;
private List<SyncViewItem> listSyncViewItems;
private Context context;
public ParentsAdapter(Context context, List<SyncBean> syncBeans) {
this.syncBeans=BeansToshowBeans(syncBeans);
Log.d("tag","parents--size->"+this.syncBeans.size());
this.context=context;
viewChild = View.inflate(context, R.layout.cta_sync_child, null);
// 转换成可以显示的数据, 已经打印出数据
// this.listSyncViewItems = BeansToshowBeans(syncBeans);
}
public void setBeans(List<SyncBean> syncBeans){
this.syncBeans=BeansToshowBeans(syncBeans);
}
@Override
public int getCount() {
return syncBeans.size();
}
@Override
public Object getItem(int arg0) {
return arg0;
}
@Override
public long getItemId(int arg0) {
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
                                // 已经打印出数据
Log.d("tag","parents-getView->"+arg0+syncBeans.get(arg0).name);
listSyncViewItems = showSyncItem(syncBeans.get(arg0), item);
TextView tvAppName = (TextView) viewChild
.findViewById(R.id.tv_sync_app);
ListView listViewChild = (ListView) viewChild
.findViewById(R.id.lv_sync_child);

tvAppName.setText(syncBeans.get(arg0).name);
mAdapter adapter=new mAdapter(context,syncBeans.get(arg0),item);
listViewChild.setAdapter(adapter);
Utility.setListViewHeightBasedOnChildren(listViewChild);
Log.d("tag","parents-id--"+viewChild.getId());
return viewChild;
} }
        //这是 里面的适配器
class mAdapter extends BaseAdapter {
private View vi = null;
// private List<SyncDataTypeBean> Adlist = new
// ArrayList<SyncDataTypeBean>();
SyncBean adSyncBean = null;
private List<SyncViewItem> AdlistSyncViewItem = new ArrayList<SyncViewItem>();
private String Adflag = null;// 标志,是上传还是下载,或者同步 /**
 * 传进来数据是可以同步,或者备份,或者恢复的数据
 * 
 * @param context
 * @param list
 * @param flag
 * @param appId
 */
public mAdapter(Context context, SyncBean syncBean, String flag) {
vi = View.inflate(context, R.layout.cta_sync_child_item, null);
this.adSyncBean = syncBean;
this.AdlistSyncViewItem = showSyncItem(adSyncBean, flag);
this.Adflag = flag;
}
/**
 * test 测试使用
 * @param context
 * @param AdlistSyncViewItems
 */
public mAdapter(Context context,List<SyncViewItem> AdlistSyncViewItems){
vi = View.inflate(context, R.layout.cta_sync_child_item, null);
this.AdlistSyncViewItem=AdlistSyncViewItem;
this.Adflag = item;
}
@Override
public int getCount() {
return AdlistSyncViewItem.size();
} @Override
public Object getItem(int arg0) {
return arg0;
} @Override
public long getItemId(int arg0) {
return arg0;
} @Override
public View getView(int location, View arg1, ViewGroup arg2) {
// 发广播 传入的数值
// final String dataTypeId=Adlist.get(currentPosition).dataTypeId;
TextView tvName = (TextView) vi.findViewById(R.id.tv_sync_sms);
TextView tvResult = (TextView) vi.findViewById(R.id.tv_sync_result);
ImageView ibSyncAction = (ImageView) vi
.findViewById(R.id.ib_sync_action01);
// CheckBox cbIsAutoUpdate=(CheckBox)
// vi.findViewById(R.id.cb_is_auto_update01);
Log.d("tag","child--getView-->"+AdlistSyncViewItem.get(location).SyncItemName);
tvName.setText(AdlistSyncViewItem.get(location).SyncItemName);
Log.d("tag", AdlistSyncViewItem.get(location).SyncItemAppID
+ "13-->getView-->"
+ AdlistSyncViewItem.get(location).SyncItemResult);
tvResult.setText(AdlistSyncViewItem.get(location).SyncItemResult);
if ("upload".equals(Adflag)) {// 上传
ibSyncAction.setImageResource(R.drawable.sync_upload_selector); // cbIsAutoUpdate.setVisibility(View.GONE);
} else if ("down".equals(Adflag)) {// 下载
ibSyncAction.setImageResource(R.drawable.sync_down_selector);
// cbIsAutoUpdate.setVisibility(View.GONE);
} else if ("sync".equals(Adflag)) {// 同步
ibSyncAction.setImageResource(R.drawable.sync_now_selector);
// cbIsAutoUpdate.setVisibility(View.VISIBLE);
}
vi.setTag(AdlistSyncViewItem.get(location));

return vi;
} }