SimpleAdapter示例

list();
//容易漏掉
		lv_content.setAdapter(new SimpleAdapter(
				Activity_personal_center.this,data, R.layout.adapter_personal_center, 
				new String[]{"time","content"}, new int[]{R.id.tv_time,R.id.tv_content}));
		new Util_Scroll_ListView().setListViewHeightBasedOnChildren(lv_content);
//不能光用this这里
sv=(ScrollView)findViewById(R.id.sv);
		sv.smoothScrollTo(0, 0);
	}
	void list(){
		data= new ArrayList<Map<String,Object>>();
		Map<String, Object> m;
		m = new HashMap<String, Object>();
		m.put("time", "2013-06-25");
		m.put("content", "我发的第一句状态");
		data.add(m);
		m = new HashMap<String, Object>();
		m.put("time", "2013-06-26");
		m.put("content", "我发的第二句状态");
		data.add(m);
		m = new HashMap<String, Object>();
		m.put("time", "2013-06-27");
		m.put("content", "我发的第三句状态");
		data.add(m);
		m = new HashMap<String, Object>();
		m.put("time", "2013-06-28");
		m.put("content", "我发的第四句状态");
		data.add(m);

	}

你可能感兴趣的:(SimpleAdapter示例)