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 ...
随机推荐
- python-单元测试unittest
目录: 1.unittest.TestCase中常用的断言方法 1.1 subTest子测试 1.2 套件测试 1.3 批量测试单个用例 2. 加载器 2.1加载器协议 2.2.执行器 TestRun ...
- [Lua]内存泄漏与垃圾回收
参考链接: http://colen.iteye.com/blog/578146 一.内存泄漏的检测 Lua的垃圾回收是自动进行的,但是我们可以collectgarbage方法进行手动回收.colle ...
- spring boot 自定义视图路径
boot 自定义访问视图路径 . 配置文件 目录结构 启动类: html页面 访问: 覆盖boot默认路径引用. 如果没有重新配置,则在pom引用模板. 修改配置文件. 注意一定要编译工程
- python入门-使用API
python入门-使用API import requests #执行API调用并存储响应 url = 'https://api.github.com/search/repositories?q=lan ...
- 12.利用kakatips对网站数据信息监控
网站信息监控 kakatips软件 百度云链接:https://pan.baidu.com/s/1lNH8OGODbIvYeFTjz6kVEQ 密码:5qtz 这是我编辑好的具体详情如下: 有效标记需 ...
- hive 索引
hive 有限的支持索引,不支持主键外键,可以对表添加索引,也可以为某个分区添加索引.维护索引也要额外的存储空间和计算资源. 创建索引需要指定索引处理器 如 as 'org.apache.hadoop ...
- 02.centos6.4找不到ifcfg-eth0(静态ip配置)
1.默认情况在/etc/sysconfig/network-scripts/目录下面找不到ifcfg-eth0文件,我们需要手动copy 1.1动态ip配置 #cp ifcfg-lo ifcfg-et ...
- Swoole 进程管理
用法: $process = new swoole_process(function(){ //这里写业务代码 },true) //开启进程,返回进程pid $pid = $process->s ...
- TCP的窗口滑动机制
TCP的滑动窗口主要有两个作用,一是提供TCP的可靠性,二是提供TCP的流控特性.同时滑动窗口机制还体现了TCP面向字节流的设计思路. 可靠:对发送的数据进行确认 流控制:窗口大小随链路变化. 一.t ...
- MiniDao支持ID自增主键策略,使用讲解
用法示例: /** * 插入数据(ID采用自增策略,并返回自增ID) * @param employee */ @IdAutoGenerator(generator="native" ...