BaseExpandableListAdapter

本文将指导您如何使用Android开发邮件列表应用,包括数据结构、界面设计、数据交互及性能优化等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

publicabstractclass
BaseExpandableListAdapter
extendsObject
implementsExpandableListAdapterHeterogeneousExpandableList
ClassOverview
BaseclassforaExpandableListAdapterusedtoprovidedataandViewsfromsomedatatoanexpandablelistview.
AdaptersinheritingthisclassshouldverifythatthebaseimplementationsofgetCombinedChildId(long,long)
andgetCombinedGroupId(long)arecorrectingeneratinguniqueIDsfromthegroup/childrenIDs.

BaseExpandableListAdapter实现了接口 ExpandableListAdapter
BaseExpandableListAdapter的子类
CursorTreeAdapter
ResourceCursorTreeAdapter
SimpleCursorTreeAdapter

BaseExpandableListAdapter主要实现了ExpandableListAdapter接口的四个方法
getCombinedChildId(long,long)
用于产生child的id。注意id一定要是唯一.在BaseExpandableListAdapter实现里把最高位置成了1。也就是说该id始终是个负数
getCombinedGroupId(long)
用于产生group的id。注意id一定要是唯一.在BaseExpandableListAdapter实现里把最高位置成了0。也就是说该id始终是个正数
void onGroupCollapsed(intgroupPosition)
Calledwhenagroupiscollapsed.
Group收缩时调用。好像只是个监听接口。当Group收缩时,ExpandableListView回调用。
void onGroupExpanded(intgroupPosition)
Calledwhenagroupisexpanded.
Group展开时调用Buthowtouse?
Group展开时调用。好像只是个监听接口。当Group展开时,ExpandableListView回调用
注意:对于onGroupCollapsed和onGroupExpanded,没发现BaseExpandableListAdapter在两个函数中实现什么功能。
可能只是个空实现。目的就为了让用户不再浪费时间去做个空实现。
还未实现的ExpandableListAdapter接口方法有六个:
abstractObject getChild(intgroupPosition,intchildPosition)
Getsthedataassociatedwiththegivenchildwithinthegivengroup.
abstractlong getChildId(intgroupPosition,intchildPosition)
GetstheIDforthegivenchildwithinthegivengroup.
abstractView getChildView(intgroupPosition,intchildPosition,booleanisLastChild,ViewconvertView,ViewGroupparent)
GetsaViewthatdisplaysthedataforthegivenchildwithinthegivengroup.
abstractint getChildrenCount(intgroupPosition)
Getsthenumberofchildreninaspecifiedgroup.
abstractObject getGroup(intgroupPosition)
Getsthedataassociatedwiththegivengroup.
abstractint getGroupCount()
Getsthenumberofgroups.
abstractlong getGroupId(intgroupPosition)
GetstheIDforthegroupatthegivenposition.
abstractView getGroupView(intgroupPosition,booleanisExpanded,ViewconvertView,ViewGroupparent)
GetsaViewthatdisplaysthegivengroup.
实例1
HelloExpandableListAdapter.java文件
importjava.util.List;
importandroid.app.Activity;
importandroid.os.Bundle;
importjava.util.ArrayList;
importandroid.app.ExpandableListActivity;
importandroid.content.Context;
importandroid.graphics.drawable.Drawable;
importandroid.os.CountDownTimer;
importandroid.util.Log;
importandroid.view.LayoutInflater;
importandroid.view.View;
importandroid.view.ViewGroup;
importandroid.widget.BaseExpandableListAdapter;
importandroid.widget.ExpandableListAdapter;
importandroid.widget.ExpandableListView;
importandroid.widget.ImageView;
importandroid.widget.LinearLayout;
importandroid.widget.ProgressBar;
importandroid.widget.TextView;
importandroid.widget.ExpandableListView.OnGroupClickListener;
importandroid.widget.ExpandableListView.OnChildClickListener;
publicclass HelloExpandableListAdapterextendsActivity{
privateString mMailboxList[]={
"Inbox","Sentbox","Draft",
"Outbox","Emailinbox","Conversation",
"Trash","Myfolders"
};

finalstaticString mLoading="Loadingmessage...";

privateString mSender[][]={{"Andrew1","Andrew2","Andrew3","Andrew4","Andrew5","Andrew6"},
{"Jeff1","Jeff2","Jeff3","Jeff4","Jeff5","Jeff6","Jeff7"},
{"ED1","ED2","ED3","ED4","ED5"},
{"Rachel1","Rachel2","Rachel3","Rachel4"},
{"Sean1","Sean2","Sean3","Sean4","Sean5"},
{"Karen1","Karen2","Karen3","Karen4","Karen5","Karen6","Karen7"},
{"Lisa1","Lisa2","Lisa3","Lisa4","Lisa5"},
{"Rain1","Rain2","Rain3","Rain4","Rain5"}};
privateString mMailContext[][]={{"I'mgoingtogotowatchmovie!","Hello....","Nicetomeetyou","Callmeplz..","hi","Callmeplz.."},
{"hello","Callmeplz..","hello","I'mgoingtogotowatchmovie!","Hello....","Nicetomeetyou","Callmeplz.."},
{"hi","Callmeplz..","hi","Callmeplz..","hi"},
{"I'mgoingtogotowatchmovie!","Hello....","Nicetomeetyou","Callmeplz.."},
{"hi","Callmeplz..","hi","Callmeplz..","hi"},
{"12312412","12414124","12412421","458645754","dfgsdgsdf","sdfgdfgh","sdfgdsfgh"},
{"vclkj","lkvoajh","alskdjfoivj","jvlkjasldkf","79837214"},
{"975432","kbvhuoisj","4362435,","342532","236dgasdt"}};

privateString mDate[][]={{"11/22/09","11/23/08","09/11/07","02/03/05","00/09/09","11/11/11"},
{"12/12/12","12/25/09","01/03/09","11/22/09","11/23/08","09/11/07","02/03/05"},
{"00/09/09","11/11/11","12/12/12","12/25/09","01/03/09"},
{"11/22/09","11/23/08","09/11/07","02/03/05"},
{"00/09/09","11/11/11","12/12/12","12/25/09","01/03/09"},
{"12/12/12","12/25/09","01/03/09","11/22/09","11/23/08","09/11/07","02/03/05"},
{"00/09/09","11/11/11","12/12/12","12/25/09","01/03/09"},
{"00/09/09","11/11/11","12/12/12","12/25/09","01/03/09"}};
ExpandableListAdaptermAdapter;
protectedArrayList<GroupItem> groupList=newArrayList<GroupItem>();
ArrayList<ArrayList<ChildItem>> childrenList=newArrayList<ArrayList<ChildItem>>();
/**Calledwhentheactivityisfirstcreated.*/
@Override
publicvoid onCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ExpandableListViewexpandableListView=(ExpandableListView)findViewById(R.id.ExpandableListView01);

//initializingExpandedmailboxlistdata
for(inti=0;i<mMailboxList.length;i++){
GroupItemitem=newGroupItem( mMailboxList[i]<wbr style="line-height:25px"><span style="color:#3366ff; line-height:25px">);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#0000ff; line-height:25px">groupList.add(item);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">ArrayList&lt;ChildItem&gt;childItems=newArrayList&lt;ChildItem&gt;();</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">ChildItemitems=newChildItem(mLoading,null,null);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">childItems.add(items);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">childrenList.add(childItems);</span><br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#808080; line-height:25px">//Setupouradapter</span><br style="line-height:25px"><span style="color:#ff6600; line-height:25px">mAdapter=newExpandedMailboxListAdapter(this,groupList,childrenList);</span><br style="line-height:25px"> expandableListView.setAdapter(mAdapter);<br style="line-height:25px"> expandableListView.setGroupIndicator(null);<span style="color:#808080; line-height:25px">//Groupindicatordisable</span><br style="line-height:25px"><br style="line-height:25px"> expandableListView.setOnGroupClickListener(newOnGroupClickListener(){<br style="line-height:25px"> publicbooleanonGroupClick(ExpandableListViewmExpandableList,Viewarg1,<br style="line-height:25px"> finalintgroupPosition,longid){<br style="line-height:25px"><span style="color:#808080; line-height:25px">//这里的id就是getGroupId中得到的</span><br style="line-height:25px"><span style="color:#0000ff; line-height:25px">Log.i("hubin","G:"+groupPosition+"id:"+id);</span><br style="line-height:25px"> newCountDownTimer(3000,50){<br style="line-height:25px"> publicvoidonTick(longmillisUntilFinished){<br style="line-height:25px"><br style="line-height:25px"> }<br style="line-height:25px"> publicvoidonFinish(){<br style="line-height:25px"> expandableListChange(groupPosition);<br style="line-height:25px"> }<br style="line-height:25px"> }.start();<br style="line-height:25px"><span style="color:#993300; line-height:25px">return</span>false;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"> });<br style="line-height:25px"> expandableListView.setOnChildClickListener(newOnChildClickListener(){<br style="line-height:25px"> publicbooleanonChildClick(ExpandableListViewparent,Viewv,intgroupPosition,intchildPosition,longid)<br style="line-height:25px"> {<br style="line-height:25px"><span style="color:#808080; line-height:25px">//这里的id就是getChildId中得到的</span><br style="line-height:25px"><span style="color:#0000ff; line-height:25px">Log.i("hubin","c:"+groupPosition+"id:"+id);</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">return</span>false;<br style="line-height:25px"> }<br style="line-height:25px"> }<br style="line-height:25px"> );<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">privatevoid</span><span style="color:#ff6600; line-height:25px">expandableListChange</span>(intgroupPosition){<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">ArrayList&lt;ChildItem&gt;childrenItemList=childrenList.get(groupPosition);<br style="line-height:25px"> childrenItemList.clear();<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">for</span><span style="color:#3366ff; line-height:25px">(inti=0;i&lt;mSender[groupPosition].length;i++){</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#0000ff; line-height:25px">ChildItemitems=newChildItem(</span><span style="color:#99cc00; line-height:25px"></span><span style="color:#008000; line-height:25px">mSender[groupPosition][i]</span><span style="color:#0000ff; line-height:25px">,</span><span style="color:#339966; line-height:25px">mMailContext[groupPosition][i]</span><wbr style="line-height:25px"><span style="color:#0000ff; line-height:25px">,</span><span style="color:#339966; line-height:25px">mDate[groupPosition][i]</span><wbr style="line-height:25px"><span style="color:#0000ff; line-height:25px">);</span><span style="color:#3366ff; line-height:25px"></span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">childrenItemList.add(i,items);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">}</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px">((BaseExpandableListAdapter)mAdapter).notifyDataSetChanged()</span>;<br style="line-height:25px"> }<br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#993300; line-height:25px">class</span><span style="color:#ff00ff; line-height:25px">ExpandedMailboxListAdapter</span>extendsBaseExpandableListAdapter{<br style="line-height:25px"><br style="line-height:25px"> privateTextViewmMailbox;<br style="line-height:25px"> privateImageViewmMailboxIcon;<br style="line-height:25px"><br style="line-height:25px"> Contextcontext;<br style="line-height:25px"> ArrayList&lt;GroupItem&gt;groupList;<br style="line-height:25px"> ArrayList&lt;ArrayList&lt;ChildItem&gt;&gt;childrenList;<br style="line-height:25px"><span style="color:#ff00ff; line-height:25px">ExpandedMailboxListAdapter</span>(Contextcontext,ArrayList&lt;GroupItem&gt;groupList,ArrayList&lt;ArrayList&lt;ChildItem&gt;&gt;childrenList)<br style="line-height:25px"> {<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">this.context=context;<br style="line-height:25px"> this.groupList=groupList;<br style="line-height:25px"> this.childrenList=childrenList;</span><br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#808080; line-height:25px">/*<br style="line-height:25px"> *(non-Javadoc)<br style="line-height:25px"> *@seeandroid.widget.ExpandableListAdapter#getChild(int,int)<br style="line-height:25px"> */</span><br style="line-height:25px"> publicObjectgetChild(intarg0,intarg1){<br style="line-height:25px"> returnnull;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">publiclong</span><span style="color:#ff6600; line-height:25px">getChildId</span>(intgroupPosition,intchildPosition){<br style="line-height:25px"><span style="color:#993300; line-height:25px">return</span><span style="color:#0000ff; line-height:25px">childPosition</span>;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicint</span><span style="color:#ff6600; line-height:25px">getChildrenCount</span>(intgroupPosition){<br style="line-height:25px"><span style="color:#993300; line-height:25px">return</span><span style="color:#0000ff; line-height:25px">childrenList.get(groupPosition).size();</span><br style="line-height:25px"> }<br style="line-height:25px"> finalstaticStringmLoading="Loadingmessage...";<br style="line-height:25px"><span style="color:#808080; line-height:25px">/**<br style="line-height:25px"> *Getchildviewandsetchilddata.<br style="line-height:25px"> *convertViewisreusedview<br style="line-height:25px"> */</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicView</span><span style="color:#ff6600; line-height:25px">getChildView</span>(intgroupPosition,intchildPosition,booleanisLastChild,ViewconvertView,ViewGroupparent){<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">LinearLayoutmTodoView=null;<br style="line-height:25px"> TextViewmailSender;<br style="line-height:25px"> TextViewcontent;<br style="line-height:25px"> TextViewsubDate;<br style="line-height:25px"> ProgressBarprogress;<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(convertView==null){<br style="line-height:25px"> LayoutInflatervi=null;<br style="line-height:25px"> vi=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);<br style="line-height:25px"> mTodoView=(LinearLayout)vi.inflate(R.layout.listlayout_child,parent,false);<br style="line-height:25px"> }<br style="line-height:25px"> else{<br style="line-height:25px"> mTodoView=(LinearLayout)convertView;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"> progress=(ProgressBar)mTodoView.findViewById(R.id.child_progressbar);<br style="line-height:25px"> mailSender=(TextView)mTodoView.findViewById(R.id.child_text1);<br style="line-height:25px"> content=(TextView)mTodoView.findViewById(R.id.child_text2);<br style="line-height:25px"> subDate=(TextView)mTodoView.findViewById(R.id.child_text3);<br style="line-height:25px"></span><span style="color:#0000ff; line-height:25px">ChildItemchildItem=</span><span style="color:#339966; line-height:25px">childrenList</span><span style="color:#0000ff; line-height:25px">.get(groupPosition).get(childPosition);</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(childItem.getSender()==mLoading){<br style="line-height:25px"> progress.setVisibility(View.VISIBLE);<br style="line-height:25px"> progress.setIndeterminate(true);<br style="line-height:25px"> mailSender.setText(childItem.getSender());<br style="line-height:25px"> }else{<br style="line-height:25px"> progress.setVisibility(View.GONE);<br style="line-height:25px"> mailSender.setText(childItem.getSender());<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(childItem.getContent()==null){<br style="line-height:25px"> content.setVisibility(View.GONE);<br style="line-height:25px"> }</span><span style="color:#993300; line-height:25px">else</span><span style="color:#3366ff; line-height:25px">{<br style="line-height:25px"> content.setVisibility(View.VISIBLE);<br style="line-height:25px"> content.setText(childItem.getContent());<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(childItem.getDate()==null){<br style="line-height:25px"> subDate.setVisibility(View.GONE);<br style="line-height:25px"> }</span><span style="color:#993300; line-height:25px">else</span><span style="color:#3366ff; line-height:25px">{<br style="line-height:25px"> subDate.setVisibility(View.VISIBLE);<br style="line-height:25px"> subDate.setText(childItem.getDate());<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"></span><span style="color:#993300; line-height:25px">return</span><span style="color:#3366ff; line-height:25px">mTodoView;</span><br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#808080; line-height:25px">/*<br style="line-height:25px"> *(non-Javadoc)<br style="line-height:25px"> *@seeandroid.widget.ExpandableListAdapter#getGroup(int)<br style="line-height:25px"> */</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">public</span>ObjectgetGroup(intgroupPosition){<br style="line-height:25px"> returnnull;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicint</span>getGroupCount(){<br style="line-height:25px"><span style="color:#993300; line-height:25px">return</span><span style="color:#0000ff; line-height:25px">groupList.size();</span><br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">publiclong</span>getGroupId(intgroupPosition){<br style="line-height:25px"> returngroupPosition;<br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#808080; line-height:25px">/**<br style="line-height:25px"> *GetGroupviewandsetgroupdata.<br style="line-height:25px"> *convertViewisreusedview<br style="line-height:25px"> */</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">publicView</span><span style="color:#ff6600; line-height:25px">getGroupView</span>(intgroupPosition,booleanisExpanded,ViewconvertView,ViewGroupparent){<br style="line-height:25px"><span style="color:#3366ff; line-height:25px">LinearLayoutmTodoView=null;<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">if</span><span style="color:#3366ff; line-height:25px">(convertView==null){<br style="line-height:25px"> LayoutInflatervi=null;<br style="line-height:25px"> vi=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);<br style="line-height:25px"> mTodoView=(LinearLayout)vi.inflate(R.layout.listlayout_group,parent,false);<br style="line-height:25px"> }<br style="line-height:25px"></span><span style="color:#993300; line-height:25px">else</span><span style="color:#3366ff; line-height:25px">{<br style="line-height:25px"> mTodoView=(LinearLayout)convertView;<br style="line-height:25px"> }<br style="line-height:25px"> mMailbox=(TextView)mTodoView.findViewById(R.id.text1);<br style="line-height:25px"></span><span style="color:#0000ff; line-height:25px">mMailbox.setText(groupList.get(groupPosition).getMailbox());</span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><br style="line-height:25px"><span style="color:#3366ff; line-height:25px"></span><span style="color:#993300; line-height:25px">return</span><span style="color:#3366ff; line-height:25px">mTodoView;</span><br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#808080; line-height:25px">//IndicateswhetherthechildandgroupIDsarestable</span><br style="line-height:25px"> publicbooleanhasStableIds(){<br style="line-height:25px"> returntrue;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#808080; line-height:25px">//Whetherthechildatthespecifiedpositionisselectable</span>.<br style="line-height:25px"> publicbooleanisChildSelectable(intgroupPosition,intchildPosition){<br style="line-height:25px"> returntrue;<br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#993300; line-height:25px">publiclong</span>getCombinedChildId(longgroupId,longchildId)<br style="line-height:25px"> {<br style="line-height:25px"> longres=super.getCombinedChildId(groupId,childId);<br style="line-height:25px"> Log.i("hubin","cc:"+res);<br style="line-height:25px"> returnres;<br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#993300; line-height:25px">publiclong</span>getCombinedGroupId(longgroupId)<br style="line-height:25px"> {<br style="line-height:25px"> longres=super.getCombinedGroupId(groupId);<br style="line-height:25px"> Log.i("hubin","cg:"+res);<br style="line-height:25px"> returnres;<br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#993300; line-height:25px">publicvoid</span>onGroupCollapsed(intgroupPosition)<br style="line-height:25px"> {<br style="line-height:25px"> Log.i("hubin","Collapsed");<br style="line-height:25px"> }<br style="line-height:25px"><span style="color:#993300; line-height:25px">publicvoid</span>onGroupExpanded(intgroupPosition)<br style="line-height:25px"> {<br style="line-height:25px"> Log.i("hubin","Expanded");<br style="line-height:25px"> }<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#808080; line-height:25px">/**<br style="line-height:25px"> *GroupItemclass<br style="line-height:25px"> *initGroupitemdatainlistlayoutsample12sml_group.xml<br style="line-height:25px"> *Groupitemhasownchilditem'sreference<br style="line-height:25px"> */</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">class</span><span style="color:#ff6600; line-height:25px">GroupItem</span>{<br style="line-height:25px"> StringmMailbox;<br style="line-height:25px"> publicGroupItem(StringMailbox){<br style="line-height:25px"> mMailbox=Mailbox;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"> publicStringgetMailbox(){<br style="line-height:25px"> returnmMailbox;<br style="line-height:25px"> }<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#808080; line-height:25px">/**<br style="line-height:25px"> *ChildItemclass<br style="line-height:25px"> *initchilditemdatainlistlayoutsample12sml_child.xml<br style="line-height:25px"> */</span><br style="line-height:25px"><span style="color:#993300; line-height:25px">class</span><span style="color:#ff6600; line-height:25px">ChildItem</span>{<br style="line-height:25px"> privateStringmSender;<br style="line-height:25px"> privateStringmContext;<br style="line-height:25px"> privateStringmDate;<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">public</span>ChildItem(StringSender,StringContext,StringDate){<br style="line-height:25px"> mSender=Sender;<br style="line-height:25px"> mContext=Context;<br style="line-height:25px"> mDate=Date;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">public</span>StringgetSender(){<br style="line-height:25px"> returnmSender;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">public</span>StringgetContent(){<br style="line-height:25px"> returnmContext;<br style="line-height:25px"> }<br style="line-height:25px"><br style="line-height:25px"><span style="color:#993300; line-height:25px">public</span>StringgetDate(){<br style="line-height:25px"> returnmDate;<br style="line-height:25px"> } </wbr></wbr></wbr>
}
main.xml文件
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
< ExpandableListView android:id="@+id/ExpandableListView01"android:layout_width="wrap_content"android:layout_height="wrap_content">
</ExpandableListView>
</LinearLayout>
listlayout_group.xml文件
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:paddingBottom="8dip"
android:orientation="horizontal"
android:paddingTop="5dip"
android:layout_height="65.33dp"
android:paddingLeft="4.66dp"
android:paddingRight="13.33dp">
<TextView
android:id="@+id/text1"
android:layout_marginLeft="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
/>
</LinearLayout>
listlayout_child.xml文件
<?xmlversion="1.0"encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:paddingRight="13.33dp"
android:layout_height="65.33dp"
android:paddingLeft="31.9dp"
android:gravity="center_vertical">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/child_progressbar"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="5dp"
android:minHeight="32dp"
android:maxHeight="32dp"
android:minWidth="32dp"
android:maxWidth="32dp"
android:indeterminateOnly="false">
</ProgressBar>
<TextView
android:id="@+id/child_text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"/>
</LinearLayout>

<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="6dip">
<TextView
android:id="@+id/child_text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_weight="1"/>
<TextView
android:id="@+id/child_text3"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
</LinearLayout>

</LinearLayout>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值