带标题和内容的

private String[] mtitle={"姓名","年龄","生日",};
private String[] marg={"雷斯洋","22","10.4"};
ArrayList<Map<String,Object>> al=new ArrayList<Map<String,Object>>();

for (int i = 0; i < mtitle.length; i++) {
Map<String,Object> map=new HashMap<String, Object>();
map.put("title", mtitle[i]);
map.put("arg", marg[i]);
al.add(map);
}

SimpleAdapter sa=new SimpleAdapter(this, al,
android.R.layout.simple_expandable_list_item_2, new String[]{"title","arg"},
new int[]{android.R.id.text1,android.R.id.text2});
setListAdapter(sa);

带图片的
自定义xml
private String[] mtitle={"姓名","年龄","生日",};
private String[] marg={"雷斯洋","22","10.4"};
ArrayList<Map<String,Object>> al=new ArrayList<Map<String,Object>>();

for (int i = 0; i < mtitle.length; i++) {
Map<String,Object> map=new HashMap<String, Object>();
map.put("image",R.drawable.ic_launcher);
map.put("title", mtitle[i]);
map.put("arg", marg[i]);
al.add(map);
}

SimpleAdapter sa=new SimpleAdapter(this, al,
R.layout.xml, new String[]{"image","title","arg"},
new int[]{R.id.image,R.id.title,R.id.text});
setListAdapter(sa);

listview的用法的更多相关文章

  1. treeview和listview的用法

    今天无聊中弄了个小东西,熟悉一下对listview和treeview的用法.代码如下:  public partial class Form1 : Form     {         private ...

  2. xamarin android listview的用法

    listview也许是用的非常频繁的一个控件之一,下面我写一个xamarin的listview栗子,大家尝一尝xamarin android开发的乐趣.原谅我的大小写吧. listview绑定自定义的 ...

  3. Android学习总结(十三) ———— ListView 简单用法

    一.ListView的基本概念 在Android所有常用的原生控件当中,用法最复杂的应该就是ListView了,它专门用于处理那种内容元素很多,手机屏幕无法展示出所有内容的情况.ListView可以使 ...

  4. Android中ListView的用法

    使用方法1 显示简单的文本 在layout文件中像加入普通控件一样在layout文件中引入ListView <ListView android:id="@+id/list_view&q ...

  5. Delphi ListView基本用法大全

    //增加项或列(字段) ListView1.Clear; ListView1.Columns.Clear; ListView1.Columns.Add; ListView1.Columns.Add; ...

  6. Android笔记: ListView基本用法-ArrayAdapter

    ListView实现过程: 新建适配器->添加数据源到适配器->视图加载适配器 数据适配器: 把复杂的数据(数组.链表.数据库.集合等)填充在制定的试图界面上. 两种常用数据适配器 Arr ...

  7. React-Native Listview组件用法详解

    ListView作为React Native的核心组件,用于高效地显示一个可以垂直滚动的变化的数据列表.其中最重要的属性之一是DataSource,列表依赖的数据源,用于实例化一个ListView对象 ...

  8. WinForm关于listview的用法介绍

    public Form1() { InitializeComponent(); //控件的行为 listView1.Bounds = , ), , ));//相对位置 listView1.View = ...

  9. Delphi ListView的用法

    //增加 i := ListView1.Items.Count; with ListView1 do begin ListItem:=Items.Add; ListItem.Caption:= Int ...

随机推荐

  1. onethink导出excel

    function customer_daochu() { /** * 客户名单导出 * */ $customer = D('WcoaUCustomers'); $data = $customer-&g ...

  2. 替换url中某个参数的值或是添加某个参数的方法(js 分页上下页可以使用)

    function changeUrl(base, find, value) { var offset = base.indexOf(find); var index; var rr = ''; if( ...

  3. windows8.1下php环境搭建及基本配置(php+apache+mysql)

    一.php下载安装:php-5.6.1-Win32-VC11-x64.zip.解压,操作: 1.复制php.ini-production,更名为php.ini 2.在环境变量PATH末尾添加:D:\p ...

  4. EasyUI ComboGrid的绑定,上下键和回车事件,输入条件查询

    首先我们先看一下前台的绑定事件 1.先定义标签 <input id="cmbXm" type="text" style="width: 100p ...

  5. python tips(持续更新)

    1. 引用上一层目录 import syssys.path.append('..')import xx 2. python json JSON是一种轻量级的数据交换格式.可以解决数据库中文存储问题,对 ...

  6. jquery 显示弹出层可利用动画效果

    1 show()方法和hide()方法 $("selector").show()  从display:none还原元素默认或已设置的display属性$("selecto ...

  7. Linux网络编程(多人在线聊天系统)

    一.首先是服务器的建立 首先是一个信号终止程序,发信号ctrl+c终止程序,而是是初始化网络通信. 创建一个描述符负责绑定服务器和监听服务器接收客户端的消息. socket()->sockadd ...

  8. android densityDpi 的由来

    ---恢复内容开始--- 今天做屏幕适配的时候,发现一个奇怪的现象: HTC D820u/ 红米Note/HONOR H30-L02 /Coolpad 8297-T01 4款手机的分辨率均为 1280 ...

  9. The first day to learn Englisht

    IF you want to go fast,to alone. IF you want to go far,go with others.

  10. linux通过端口号查找程序执行路径

    第一种: 查看ssh服务 [root@localhost shell]# netstat -anlp | grep :22tcp        0      0 0.0.0.0:22          ...