android listiew适配器

来源:互联网 发布:arraypush 二维数组 编辑:程序博客网 时间:2024/06/06 03:59
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);
原创粉丝点击