ListView详解(二)之simpleAdapter用法
一、SimpleAdapter的参数说明 SimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to) 第一个参数 表示上下文 第二个参数表示生成一个Map(String ,Object)列表选项 第三个参数表示界面布局文件的ID, 表示该文件作为列表项的组件 第四个参数表示该Map对象的哪些key对应value来生成列表项 第五个参数表示来填充的组件 Map对象key对应的资源一依次填充组件 顺序有对应关系 注意的是map对象可以key可以找不到 但组件的必须要有资源填充 因为找不到key也会返回null 其实就相当于给了一个null资源 二、使用说明 布局文件一、main.xml 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:paddingBottom="