//SimpleAdapter绑定
ArrayList<HashMap<String, Object>> lstImageItem = new ArrayList<HashMap<String, Object>>();
HashMap<String,Object> map = new HashMap<String,Object>();
map.put("ItemImage",图片ID);
map.put("ItemText",显示的字符);
lstImageItem.add(map);
saImageItems = new SimpleAdapter(this,
lstImageItem,
R.layout.gridview,
new String[] {"ItemImage","ItemText"},
new int[] {R.id.ItemImage,R.id.ItemText});
gridView.setAdapter(saImageItems);
1 <?xml version="1.0" encoding="utf-8"?> //gridview布局模版
2 <RelativeLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:layout_height="wrap_content"
5 android:paddingBottom="4dip" android:layout_width="fill_parent">
6 <ImageView
7 android:layout_height="wrap_content"
8 android:id="@+id/ItemImage"
9 android:layout_width="wrap_content"
10 android:layout_centerHorizontal="true">
11 </ImageView>
12 <TextView
13 android:layout_width="wrap_content"
14 android:layout_below="@+id/ItemImage"
15 android:layout_height="wrap_content"
16 android:text="TextView01"
17 android:layout_centerHorizontal="true"
18 android:id="@+id/ItemText">
19 </TextView>
20 </RelativeLayout>