public class MainActivity extends Activity {
private GridView gv;
private SimpleAdapter sim_adapter;
private ListdataList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gv=(GridView) findViewById(R.id.gridView1);
dataList=new ArrayList();
sim_adapter=new SimpleAdapter(this, getData(), R.layout.item, new String[]{"img","text"}, new int[]{R.id.imageView1,R.id.textView1});
gv.setAdapter(sim_adapter);
}
private List getData(){
int[] img=new int[]{R.drawable.img1,R.drawable.img2,R.drawable.img3,R.drawable.img4,R.drawable.img5};
String[] imgName=new String[]{"图片1","图片2","图片3","图片4","图片5"};
Mapmap=new HashMap();
for(int i=0;i |