android listiew适配器

List<Map<String>> Items = new ArrayList<Map<String>>();


// 把该显示的内容放到list中


for (int i = 0; i < HELP_NAME.length; i++)


{


Map<String, Object> item = new HashMap<String, Object>();


item.put("textview1", HELP_NAME[i]);


Items.add(item);


}


// 构建适配器Adapter,将数据与显示数据的布局页面绑定


SimpleAdapter simpleAdapter = new SimpleAdapter(this, Items,


R.layout.listitem, new String[] { "textview1", "image" },


new int[] { R.id.text_item_id});


// 通过setAdapter()方法把适配器设置给ListView


setListAdapter(simpleAdapter);

你可能感兴趣的:(android)