Simpleadapter的简单用法

时间:2018-09-01 11:09:53
【文件属性】:

文件名称:Simpleadapter的简单用法

文件大小:414KB

文件格式:RAR

更新时间:2018-09-01 11:09:53

adapter

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv = (ListView) findViewById(R.id.listview); SimpleAdapter adapter = new SimpleAdapter(this, getData(), R.layout.list_item, new String[] { "img", "title", "info" }, new int[] { R.id.img, R.id.title, R.id.info }); lv.setAdapter(adapter); } private List> getData() { List> list = new ArrayList>(); Map map = new HashMap(); map.put("img", R.drawable.aa); map.put("title", "111"); map.put("info", "数字111"); list.add(map); map = new HashMap(); map.put("img", R.drawable.ic_launcher); map.put("title", "aaa"); map.put("info", "字母aaa"); list.add(map); map = new HashMap(); map.put("img", R.drawable.aa); map.put("title", "222"); map.put("info", "数字222"); list.add(map); map = new HashMap(); map.put("img", R.drawable.ic_launcher); map.put("title", "bbb"); map.put("info", "字母bbb"); list.add(map); map = new HashMap(); map.put("img", R.drawable.aa); map.put("title", "333"); map.put("info", "数字333"); list.add(map); map = new HashMap(); map.put("img", R.drawable.ic_launcher); map.put("title", "ccc"); map.put("info", "字母ccc"); list.add(map); return list; }


【文件预览】:
Simpleadapter
----.project(849B)
----project.properties(563B)
----src()
--------com()
----AndroidManifest.xml(796B)
----res()
--------drawable-ldpi()
--------drawable-hdpi()
--------values-v11()
--------menu()
--------drawable-mdpi()
--------layout()
--------drawable-xhdpi()
--------values()
--------values-v14()
----assets()
----gen()
--------com()
----libs()
--------android-support-v4.jar(341KB)
----.classpath(364B)
----proguard-project.txt(781B)
----ic_launcher-web.png(36KB)
----bin()
--------classes()
--------AndroidManifest.xml(796B)
--------jarlist.cache(119B)
--------res()

网友评论