list嵌套list

时间:2018-02-05 04:38:56
【文件属性】:

文件名称:list嵌套list

文件大小:1.63MB

文件格式:RAR

更新时间:2018-02-05 04:38:56

list嵌套list

仿某团list里嵌套list\ package com.zl.listview; import java.util.ArrayList; import java.util.HashMap; import com.kjy.kjylistview.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.Toast; /** * @author zl * @time 2014年12月24日15:37:18 */ public class QianTaoListviewActivity extends Activity { private ListView listView; private ArrayList> parentList, childList; private ParentAdapter parentAdapter; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_qiantao); init(); } private void init() { listView = (ListView) findViewById(R.id.qiantao_lv); getList(); } private void getList() { parentList = new ArrayList>(); for (int i = 1; i < 10; i++) { childList = new ArrayList>(); for (int j = i < 7 ? i : 7; j < 9; j++) { HashMap ParentMap = new HashMap(); ParentMap.put("parent_title", "三木铁板烧" + i); ParentMap.put("parent_address", "8." + i); ParentMap.put("parent_distance", "1" + i); ParentMap.put("parent_distance1", "已售123" + i); childList.add(ParentMap); } HashMap map = new HashMap(); map.put("child_item_title", "九州八拖二火锅" + i); map.put("child_item_price_old", "4." + i + "分"); map.put("child_item_price_score", "(100人)"); map.put("parent_lv", childList); parentList.add(map); } parentAdapter = new ParentAdapter(parentList, QianTaoListviewActivity.this); listView.setAdapter(parentAdapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) { Intent intent = new Intent(QianTaoListviewActivity.this, Activity_1.class); Toast.makeText(QianTaoListviewActivity.this, "第" + arg2 + "个条目", Toast.LENGTH_LONG).show(); startActivity(intent); } }); } }


【文件预览】:
美团嵌套listview
----.project(844B)
----project.properties(563B)
----src()
--------com()
----AndroidManifest.xml(1KB)
----res()
--------drawable-ldpi()
--------drawable-hdpi()
--------values-v11()
--------menu()
--------drawable()
--------drawable-mdpi()
--------layout()
--------drawable-xxhdpi()
--------drawable-xhdpi()
--------values-w820dp()
--------values()
--------values-v14()
----.settings()
--------org.eclipse.jdt.core.prefs(177B)
----assets()
----gen()
--------com()
----libs()
--------android-support-v4.jar(741KB)
----.classpath(475B)
----proguard-project.txt(781B)
----ic_launcher-web.png(50KB)
----bin()
--------resources.ap_(51KB)
--------classes()
--------AndroidManifest.xml(1KB)
--------dexedLibs()
--------res()
--------classes.dex(809KB)
--------listview.apk(326KB)

网友评论