SimpleAdapter用法
【SimpleAdapter用法】
public class TestSimpleAdapter extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.testsimpleadapter);
mListView = (ListView) findViewById(R.id.mySimpleList);
mAdapter = new SimpleAdapter(this, getData(), R.layout.simpleitem, new String[]{"image", "title", "info"}, new int[]{R.id.img, R.id.title, R.id.info});
mListView.setAdapter(mAdapter);
} private List<HashMap<String, Object>> getData() {
mHashMaps = new ArrayList<HashMap<String,Object>>();
map = new HashMap<String, Object>();
map.put("image", R.drawable.gallery_photo_1);
map.put("title", "G1");
map.put("info", "google 1");
mHashMaps.add(map); map = new HashMap<String, Object>();
map.put("image", R.drawable.gallery_photo_2);
map.put("title", "G2");
map.put("info", "google 2");
mHashMaps.add(map); map = new HashMap<String, Object>();
map.put("image", R.drawable.gallery_photo_3);
map.put("title", "G3");
map.put("info", "google 3"); mHashMaps.add(map);
return mHashMaps;
}
}
参考:http://www.cnblogs.com/shang53880/archive/2011/03/15/1985062.html
SimpleAdapter用法的更多相关文章
- Android学习之适配器ArrayAdapter SimpleAdapter
Adapter是个什么角色呢?其实它的作用就是View界面和数据之间的桥梁.我们可以看作是界面数据绑定的一种理解,它所操纵的数据一般都是一些比较复杂的数据,如数组,链表,数据库,集合等. 常用的适配器 ...
- Android学习之适配器SimpleCursorAdapter
三. SimpleCursorAdapter与SimpleAdapter用法相近.只是将List对象换成了Cursor对象.而且SimpleCursorAdapter类构造方法的第四个参数from ...
- Android适配器之ArrayAdapter、SimpleAdapter和BaseAdapter的简单用法与有用代码片段(转)
摘自:http://blog.csdn.net/shakespeare001/article/details/7926783 Adapter是连接后端数据和前端显示的适配器接口,是数据Data和UI( ...
- [转]Android适配器之ArrayAdapter、SimpleAdapter和BaseAdapter的简单用法与有用代码片段
收藏ArrayAdapter.SimpleAdapter和BaseAdapter的一些简短代码片段,希望用时方便想起其用法. 1.ArrayAdapter 只可以简单的显示一行文本 代码片段: A ...
- BaseAdapter,SimpleAdapter,CursorAdapter的用法
简单好用的Adapter---ArrayAdapter ArrayAdapter是BaseAdapter的派生类,在BaseAdapter的基础上,添加了一项重大的功能:可以直接使用泛型构造. 我们先 ...
- SimpleAdapter的用法
学习listView的时候,按照例子设定item的布局为系统提供的simple_list_item_single_choice.xml@frameworks/base/core/res/res/lay ...
- ArrayAdapter、SimpleAdapter简单用法
1. 使用流程 2. ArrayAdapter new ArrayAdapter<?>(context, textViewResourceId, objects) context:上下 ...
- SimpleAdapter与listview,gridview的组合用法
首先要明白SimpleAdapter构造方法的几个参数的含义: public SimpleAdapter(Context context, List<? extends Map<Strin ...
- SimpleAdapter ArrayAdapter用法
listView = (ListView) findViewById(R.id.list_main); /* String[] strings = {"A","A&quo ...
随机推荐
- win10 mstsc 远程 windows2008R2
- 重识linux-常见压缩和解压缩命令
重识linux-常见压缩和解压缩命令 1 compress 目前已经很少使用,知道有个 不重点学习 2 gzip和zcat 目前应用最广泛 gzip [-cdtv#] 文件名 zcat 文件名.gz ...
- 《算法》第四章部分程序 part 2
▶ 书中第四章部分程序,加上自己补充的代码,随机生成各类无向图 ● 随机生成无向图 package package01; import edu.princeton.cs.algs4.StdOut; i ...
- python学习笔记_week6_面向对象
面向对象 介绍(特性(class.object--->封装.继承,多态)).--->世界万物,皆可分类:世界万物,皆可对象 只要是对象,就肯定属于某种品类:只要是对象,就肯定有属性 你是上 ...
- python中的count
count(self, sub, start=None, end = None)用于计算字符串中子序列的个数,sub, start=None, end = None定义查找范围,不写默认查找全部 举个 ...
- python中 将你的名字转化成为二进制并输出
1 name = "吴彦祖" 2 for i in name: 3 i_by = bytes(i, encoding = "utf-8") 4 for i_bi ...
- DataBinding(二):DataBinding的基本用法
转自:DataBinding系列(二):DataBinding的基本用法 1.在xml中引入一些基础变量Variables data 标签中可以有任意数量的 variable 标签.这些变量可以使Ja ...
- C# 趣味小程序(4)——遍历特定目录及其子目录
//递归方法遍历目录,并统计其中文件的数目 private int statisticFiles(string directory) { int st ...
- Redis 常见配置
- 线程池之 newScheduledThreadPool中scheduleAtFixedRate(四个参数)
转自:https://blog.csdn.net/weixin_35756522/article/details/81707276 说明:在处理消费数据的时候,统计tps,需要用一个线程监控来获得tp ...