首页 > 代码库 > SimpleAdapter用法
SimpleAdapter用法
【SimpleAdapter用法】
public class TestSimpleAdapter extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.testsimpleadapter); mListView = (ListView) findViewById(R.id.mySimpleList); mAdapter = new SimpleAdapter(this, getData(), R.layout.simpleitem, new String[]{"image", "title", "info"}, new int[]{R.id.img, R.id.title, R.id.info}); mListView.setAdapter(mAdapter); } private List<HashMap<String, Object>> getData() { mHashMaps = new ArrayList<HashMap<String,Object>>(); map = new HashMap<String, Object>(); map.put("image", R.drawable.gallery_photo_1); map.put("title", "G1"); map.put("info", "google 1"); mHashMaps.add(map); map = new HashMap<String, Object>(); map.put("image", R.drawable.gallery_photo_2); map.put("title", "G2"); map.put("info", "google 2"); mHashMaps.add(map); map = new HashMap<String, Object>(); map.put("image", R.drawable.gallery_photo_3); map.put("title", "G3"); map.put("info", "google 3"); mHashMaps.add(map); return mHashMaps; }}
参考:http://www.cnblogs.com/shang53880/archive/2011/03/15/1985062.html
SimpleAdapter用法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。