`
davice_li
  • 浏览: 90918 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

SimpleAdapter使用说明

阅读更多
也是ListAdapter的直接子类。通过SimpleAdapter可以让ListView里面每一项的内容更加人性化,通常将ListView中某项的布局信心写在一个XML文件中。
SimpleAdapter的作用是作为ArrayList和ListView的桥梁。需要注意的是,这个ArrayList里面的每一项都是一个Map<String,?>类型。
SimpleAdapter的构造函数:
public SimpleAdapter (Context context,List<? extends Map<String,?>>data,int resource,String[] from,int[] to)
其中:context:上下文
data:基于Map的List
resource:就是一个layout,一般用系统的就可以了
From:这是一个名字的数组,每一个名字都是为了在ArrayList中每一个item中索引Map<String,Object>的Object用的。
To:里边是一个TextView数组。这些TextView是以id的形式来表示的,如android.R.id.text1. 


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/linshutao/archive/2010/07/31/5779557.aspx

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics