图片列表【范型】

时间:2018-08-02 05:23:30
【文件属性】:

文件名称:图片列表【范型】

文件大小:3.35MB

文件格式:ZIP

更新时间:2018-08-02 05:23:30

列表

public class MainActivity extends Activity { ListView list; LazyAdapter adapter; private static String HOST = "http://121.199.65.88/tpcms/"; String url = "http://121.199.65.88//tpcms/index.php?s=home/Index/goods/type/1/sort/price_asc/page/2"; LazyAdapter eshopListAdapter = null; ArrayList arraylist = new ArrayList(); Handler h = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); //获得数据 ArrayList list1=productInfo((String)msg.obj); showInfoImage(list1); } }; @Override public void onCreate(Bundle savedInstanceState) { System.out.println("sdjklajsdklfj"); super.onCreate(savedInstanceState); setContentView(R.layout.main); list=(ListView)findViewById(R.id.list); new Thread() { @Override public void run() { super.run(); String str = new GetDataFromJson(MainActivity.this).getData(url); Message m = new Message(); m.obj = str; h.sendMessage(m); } }.start(); } /** * 显示商品图片 */ private void showInfoImage(final ArrayList arr) { eshopListAdapter = new LazyAdapter(this, arr) { @Override public View layoutView(ArrayList list, int position, View view) { View vi = view; if (view == null) //将布局做成一个view vi = LayoutInflater.from(MainActivity.this).inflate(R.layout.item3, null); //实例化控件 final ImageView iv = (ImageView) vi.findViewById(R.id.iv); final TextView text = (TextView) vi.findViewById(R.id.textview); final ProgressBar shopLoadBox = (ProgressBar) vi.findViewById(R.id.goods_load_box); vi.setTag(list.get(position));// 設計所有商店信息 imageLoader.DisplayImage(HOST+ arr.get(position).getImage(), iv); text.setText(arr.get(position).getTitle()); return vi; } }; list.setAdapter(eshopListAdapter); } /** * 封装商品信息 */ public ArrayList productInfo(String json) { try { JSONObject jsonObj = new JSONObject(json); int reponse = jsonObj.getInt("reponse"); String message = jsonObj.getString("messages"); String count = jsonObj.getString("count"); JSONArray arr = jsonObj.getJSONArray("goodslist"); for(int i=0;i


【文件预览】:
DataListTest2
----bin()
--------classes.dex(1.26MB)
--------DataListTest.apk(829KB)
--------res()
--------jarlist.cache(387B)
--------R.txt(30KB)
--------dexedLibs()
--------classes()
--------resources.ap_(417KB)
--------DataListTest2.apk(827KB)
--------AndroidManifest.xml(1020B)
----res()
--------drawable-ldpi()
--------values-v11()
--------menu()
--------values-v14()
--------drawable-hdpi()
--------drawable-xhdpi()
--------drawable-xxhdpi()
--------values()
--------drawable-mdpi()
--------layout()
--------values-w820dp()
----proguard-project.txt(781B)
----ic_launcher-web.png(50KB)
----assets()
----gen()
--------android()
--------com()
----src()
--------com()
----.project(849B)
----.classpath(475B)
----project.properties(609B)
----AndroidManifest.xml(1020B)
----libs()
--------android-support-v4.jar(633KB)

网友评论