如题 代码如下
m_GroupData = new ArrayList<Map<String, Object>>();
m_ChildData = new ArrayList< List<Map<String, Object>>>();
m_GroupFriends = new ArrayList<List<Friend>>();
Map<String, Object> TmpGroupItem = new HashMap<String, Object>();
TmpGroupItem.put(GROUPNAME, "GroupName");
TmpGroupItem.put(GROUPSIGN, "GroupSign");
TmpGroupItem.put(GROUPHEAD, 2);
TmpGroupItem.put(NUM, "12");
m_GroupData.add(TmpGroupItem); List<Map<String, Object>> TmpChildGroup = new ArrayList<Map<String, Object>>();
Map<String, Object> TmpChildItem = new HashMap<String, Object>();
TmpChildItem.put(NAME, "childname");
TmpChildItem.put(SIGN, "childsign");
TmpChildItem.put(HEAD, 3);
TmpChildItem.put(SCORE, "childscore");
TmpChildItem.put(TIMES, "12");
TmpChildGroup.add(TmpChildItem);
m_ChildData.add(TmpChildGroup);
m_Adapter = new SimpleExpandableListAdapter(context, m_GroupData, R.layout.groupitem,
new String[]{GROUPNAME, GROUPSIGN, GROUPHEAD, NUM},
new int[]{R.id.GroupName, R.id.GroupSiged, R.id.GroupImg, R.id.Num},
m_ChildData, R.layout.friends,
new String[]{NAME, SIGN, HEAD, SCORE, TIMES},
new int[]{R.id.Name, R.id.Siged, R.id.HeadImg, R.id.Score, R.id.SuccessTime});
this.setAdapter(m_Adapter);
groupitem.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ImageView android:id="@+id/GroupImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10px"/>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:id="@+id/GroupName"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="1"
android:textSize="22px" />
<TextView android:id="@+id/GroupSiged"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="2"
android:textSize="13px" />
</LinearLayout>
<TextView
android:id="@+id/Num"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
/>
</LinearLayout>friends.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/HeadImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10px"/>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:id="@+id/Name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="1"
android:textSize="22px" />
<TextView android:id="@+id/Siged"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="2"
android:textSize="13px" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@id/Score"
android:layout_weight="2"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@id/SuccessTime"
android:layout_weight="2"
/>
</LinearLayout>
</LinearLayout>
m_GroupData = new ArrayList<Map<String, Object>>();
m_ChildData = new ArrayList< List<Map<String, Object>>>();
m_GroupFriends = new ArrayList<List<Friend>>();
Map<String, Object> TmpGroupItem = new HashMap<String, Object>();
TmpGroupItem.put(GROUPNAME, "GroupName");
TmpGroupItem.put(GROUPSIGN, "GroupSign");
TmpGroupItem.put(GROUPHEAD, 2);
TmpGroupItem.put(NUM, "12");
m_GroupData.add(TmpGroupItem); List<Map<String, Object>> TmpChildGroup = new ArrayList<Map<String, Object>>();
Map<String, Object> TmpChildItem = new HashMap<String, Object>();
TmpChildItem.put(NAME, "childname");
TmpChildItem.put(SIGN, "childsign");
TmpChildItem.put(HEAD, 3);
TmpChildItem.put(SCORE, "childscore");
TmpChildItem.put(TIMES, "12");
TmpChildGroup.add(TmpChildItem);
m_ChildData.add(TmpChildGroup);
m_Adapter = new SimpleExpandableListAdapter(context, m_GroupData, R.layout.groupitem,
new String[]{GROUPNAME, GROUPSIGN, GROUPHEAD, NUM},
new int[]{R.id.GroupName, R.id.GroupSiged, R.id.GroupImg, R.id.Num},
m_ChildData, R.layout.friends,
new String[]{NAME, SIGN, HEAD, SCORE, TIMES},
new int[]{R.id.Name, R.id.Siged, R.id.HeadImg, R.id.Score, R.id.SuccessTime});
this.setAdapter(m_Adapter);
groupitem.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ImageView android:id="@+id/GroupImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10px"/>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:id="@+id/GroupName"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="1"
android:textSize="22px" />
<TextView android:id="@+id/GroupSiged"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="2"
android:textSize="13px" />
</LinearLayout>
<TextView
android:id="@+id/Num"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
/>
</LinearLayout>friends.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/HeadImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10px"/>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView android:id="@+id/Name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="1"
android:textSize="22px" />
<TextView android:id="@+id/Siged"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#FFFFFFFF"
android:layout_weight="2"
android:textSize="13px" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@id/Score"
android:layout_weight="2"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@id/SuccessTime"
android:layout_weight="2"
/>
</LinearLayout>
</LinearLayout>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货