《AndroidListView实现复杂下载列表.docx》由会员分享,可在线阅读,更多相关《AndroidListView实现复杂下载列表.docx(5页珍藏版)》请在三一办公上搜索。
1、AndroidListView实现复杂下载列表AVD SDK Activity_main.xml Data-list.xml LinearLayout xmlns= android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent xmlns:android= Mainactivity.java package com.example.androidtest_listview03; import java.util.ArrayList; import java.ut
2、il.HashMap; import java.util.List; import java.util.Map; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.ListView; import android.widget.SimpleAdapter; public class MainActivity extends Activity private int pic=new intR.drawable.pic_android,R.dr
3、awable.pic_game,R.drawable.pic_javaee,R.drawable.pic_javase,R.drawable.pic_javaweb; private String data=new StringAndroid,张永丰,Photoshop,藩瑞,Illustrator,向中华,广告创意,向中华,WEB开发,张永丰; private ListMap list=new ArrayListMap; private ListView videoList; private SimpleAdapter simpleAdapter=null; Override protect
4、ed void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); videoList=(ListView)findViewById(R.id.videoListId); System.out.println(ok); for(int x=0;xdata.length;x+) Map map=new HashMap; map.put(picId, String.valueOf(this.picx); map.put(titl
5、eId, datax0); map.put(authorId, datax1); map.put(typeId, 免费); map.put(scoreId, String.valueOf(R.drawable.start_05); list.add(map); simpleAdapter=new SimpleAdapter(this,list,R.layout.data_list,new StringpicId,titleId,authorId,typeId,scoreId,new intR.id.picId,R.id.titleId,R.id.authorId,R.id.typeId,R.id.scoreId); videoList.setAdapter(simpleAdapter); Override public 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;