《Android-ListView实现复杂下载列表》由会员分享,可在线阅读,更多相关《Android-ListView实现复杂下载列表(4页珍藏版)》请在金锄头文库上搜索。
1、AVDi ar getejl atrorinAT 丄LX UJ KDXV AVD2.2Android 2.22.28ARM Urm 处bi)11KW. ”SDKActivity_mai n.xmlvTextViewan droid:layout_width=fill_pare ntan droid:layout_height=wrap_c on te ntan droid:textSize=20pxan droid:gravity=ce nter_horiz on tal android:text =博涵视频列表 /vListViewan droid:id =+id/videoListldan
2、 droid:layout_width=fill_pare ntan droid:layout_height=wrap_c on te nt/ Data-list.xmlLin earLayoutxml ns =http:/ ndroidan droid:orie ntatio n= horiz on talan droid:layout_width=fill_pare ntan droid:layout_height=fill_pare ntxmln s:a ndroid= http:/ ndroidvTextViewan droid:id =+id/titleIdan droid:layo
3、ut_width= wrap_c onten tan droid:layout_height=wrap_c onten tan droid:paddi ng=:3pxan droid:textSize= 16px/vlmageView an droid:id =+id/scoreIdan droid:layout_width=wrap_c on te ntan droid:layout_height=wrap_c on te ntan droid:paddi ng=3px/Mai nactivity.javapackage com.example.a ndroidtest_listview03
4、;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import an droid.os.B un dle;import an droid.app.Activity;import an droid.view.Me nu;import an droid.widget.ListView;import an droid.widget.SimpleAdapter;public class Main Activity exte nds Activity privat
5、e in t pic =newin tR.drawable.pic_a ndroid,R.drawable.pic_game,R.drawable.pic_javae e,R.drawable.pic_javase,R.drawable.pic_javaweb;private Stri ng data=new Strin gA ndroid,张永丰,Photoshop,藩瑞,lllustrator,向中华, 广告创意,向中华,WEB开发,张永丰;private ListMap list=newArrayListMap();private ListView videoList;private S
6、impleAdapter simpleAdapter=n ull;Overrideprotected void on Create(B un dle saved In sta nceState) super.o nCreate(savedI nsta nceState);setCo nte ntView(R.layout.activity_mai n);videoList=(ListView)fi ndViewByld(R.id.videoListld);System.out.pri ntl n( ok);for(i nt x=0;xdata .len gth;x+)Map map=new H
7、ashMapvStri ng,Stri ng(); map.put(picld, Stri ng.valueOf(this.picx);map.put(titleld, datax0);map .put(authorld, datax1);map .put(typeld,免费);map.put(scoreld, Stri ng.valueOf(R.drawable.start_05);list.add(map); simpleAdapter=newSimpleAdapter(this,list,R.layout.data_list,newStringpicId,titleId,authorId
8、,typeId,scoreId,new intR.id.picId,R.id.titleId,R.id.authorId,R.id.typeId,R.id.scoreId );videoList.setAdapter(simpleAdapter);Overridepublic boolean onCreateOptionsMenu(Menu menu) / Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.activity_main, menu); return true;