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用法的更多相关文章

  1. Android学习之适配器ArrayAdapter SimpleAdapter

    Adapter是个什么角色呢?其实它的作用就是View界面和数据之间的桥梁.我们可以看作是界面数据绑定的一种理解,它所操纵的数据一般都是一些比较复杂的数据,如数组,链表,数据库,集合等. 常用的适配器 ...

  2. Android学习之适配器SimpleCursorAdapter

    三.   SimpleCursorAdapter与SimpleAdapter用法相近.只是将List对象换成了Cursor对象.而且SimpleCursorAdapter类构造方法的第四个参数from ...

  3. Android适配器之ArrayAdapter、SimpleAdapter和BaseAdapter的简单用法与有用代码片段(转)

    摘自:http://blog.csdn.net/shakespeare001/article/details/7926783 Adapter是连接后端数据和前端显示的适配器接口,是数据Data和UI( ...

  4. [转]Android适配器之ArrayAdapter、SimpleAdapter和BaseAdapter的简单用法与有用代码片段

      收藏ArrayAdapter.SimpleAdapter和BaseAdapter的一些简短代码片段,希望用时方便想起其用法. 1.ArrayAdapter 只可以简单的显示一行文本 代码片段: A ...

  5. BaseAdapter,SimpleAdapter,CursorAdapter的用法

    简单好用的Adapter---ArrayAdapter ArrayAdapter是BaseAdapter的派生类,在BaseAdapter的基础上,添加了一项重大的功能:可以直接使用泛型构造. 我们先 ...

  6. SimpleAdapter的用法

    学习listView的时候,按照例子设定item的布局为系统提供的simple_list_item_single_choice.xml@frameworks/base/core/res/res/lay ...

  7. ArrayAdapter、SimpleAdapter简单用法

    1. 使用流程 2. ArrayAdapter new ArrayAdapter<?>(context, textViewResourceId, objects)   context:上下 ...

  8. SimpleAdapter与listview,gridview的组合用法

    首先要明白SimpleAdapter构造方法的几个参数的含义: public SimpleAdapter(Context context, List<? extends Map<Strin ...

  9. SimpleAdapter ArrayAdapter用法

    listView = (ListView) findViewById(R.id.list_main); /* String[] strings = {"A","A&quo ...

随机推荐

  1. IntelliJ Idea设置Could not autowire. No beans of 'xxx' type found

    1.问题描述 在Idea的spring工程里,经常会遇到Could not autowire. No beans of ‘xxxx’ type found的错误提示.但程序的编译和运行都是没有问题的, ...

  2. 20165205 2017-2018-2 《Java程序设计》第九周学习总结

    20165205 2017-2018-2 <Java程序设计>第九周学习总结 教材学习内容总结 掌握URL类的使用方法 URL类的构造方法: public URL(String spec) ...

  3. gentoo raid1

    参考 gentoo wiki,和其他网页,实现两个硬盘组成 raid1. 两个硬盘一个是 sdc,一个是 sdd,都是 4T容量. 首先内核开启 Autodetect RAID arrays duri ...

  4. SLD Related Gateway Serivces Unavaliable

    SAP NW 7.4 default switched on the ACL (access control list) in gateway service, so only local acces ...

  5. 《GPU高性能编程CUDA实战》第三章 CUDA设备相关

    ▶ 这章介绍了与CUDA设备相关的参数,并给出了了若干用于查询参数的函数. ● 代码(已合并) #include <stdio.h> #include "cuda_runtime ...

  6. Hive 优化汇总

    参考: http://www.cnblogs.com/yshb/p/3147710.html http://www.cnblogs.com/sandbank/p/6408762.html 一   jo ...

  7. Python3里查看某一元素的源码(检查元素定位是否准确)

    #coding:utf-8 #显示网页元素的HTML源码from selenium import webdriver driver = webdriver.Ie()driver.implicitly_ ...

  8. Django之集合函数使用与mysql表的创建特殊字段分析

    1. 集合函数的使用场景: -- 单独使用: 不分组, 只查聚合结果 -- 分组使用: 按字段分组, 可查询分组字段与聚合结果 2. 导入聚合函数 from django.db.models impo ...

  9. js/jquery this 坑

    重要:js onclick() 函数中,取不到this !!! 错误的写法: function test(){ $(this).parent().addClass('active') } 正确的写法是 ...

  10. Hive安装 和管理