<!-- 左边图片 -->
<ImageView
android:id="@+id/photo"
android:padding="10dp"
android:layout_width="48dp"
android:layout_height="48dp" />
<!-- 右边布局 -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- 上边布局 -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<!-- 发布人 -->
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- 发布时间 -->
<TextView
android:id="@+id/publish"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right" />
</LinearLayout>
<!-- 下边发布内容 -->
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
MainActivity
private List<Map<String, ?>> getData() {
List<Map<String, ?>> data = new ArrayList<Map<String, ?>>();
Map<String, Object> item = new HashMap<String, Object>();
item.put("photo", R.drawable.p1);
item.put("name", "思考");
item.put("publish", "半分钟前");
item.put("content", "正在学习javascript,噢噢噢噢");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p2);
item.put("name", "哈哈");
item.put("publish", "5分钟前");
item.put("content", "今天真兴奋!");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p3);
item.put("name", "丽水");
item.put("publish", "5分钟前");
item.put("content", "今天糗大了!");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p4);
item.put("name", "明明");
item.put("publish", "1分钟前");
item.put("content", "今天遇到一件好搞笑的事情!");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p5);
item.put("name", "楠楠");
item.put("publish", "7分钟前");
item.put("content", "今天天气好晴朗!");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p6);
item.put("name", "楼主");
item.put("publish", "12分钟前");
item.put("content", "真高兴啊!");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p7);
item.put("name", "甜甜");
item.put("publish", "8分钟前");
item.put("content", "生命不息,运动不止");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p8);
item.put("name", "眩晕");
item.put("publish", "5分钟前");
item.put("content", "美丽的谎言");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p9);
item.put("name", "哦哦");
item.put("publish", "4分钟前");
item.put("content", "是什么阻碍了我");
data.add(item);
item = new HashMap<String, Object>();
item.put("photo", R.drawable.p10);
item.put("name", "阿华");
item.put("publish", "4分钟前");
item.put("content", "魏军狂欢!");
data.add(item);
return data;
}