android仿朋友圈教程,android 仿朋友圈动态 图片查看效果

【实例简介】

【实例截图】

dddf881e2659b223f72d49bf014c8b02.png

84bb3c6acfecae4b617617fdffef15c4.png

【核心代码】

package com.example.imagedemo;

import java.util.ArrayList;

import android.os.Bundle;

import android.app.Activity;

import android.widget.ListView;

public class MainActivity extends Activity {

/** Item数据实体集合 */

private ArrayList itemEntities;

/** ListView对象 */

private ListView listview;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

listview = (ListView) findViewById(R.id.listview);

initData();

listview.setAdapter(new ListItemAdapter(this, itemEntities));

}

/**

* 初始化数据

*/

private void initData() {

itemEntities = new ArrayList();

// 1.无图片

ItemEntity entity1 = new ItemEntity(//

"https://img-my.csdn.net/uploads/201410/19/1413698871_3655.jpg", "张三", "今天天气不错...", null);

itemEntities.add(entity1);

// 2.1张图片

ArrayList urls_1 = new ArrayList();

urls_1.add("https://img-my.csdn.net/uploads/201410/19/1413698883_5877.jpg");

ItemEntity entity2 = new ItemEntity(//

"https://img-my.csdn.net/uploads/201410/19/1413698865_3560.jpg", "李四", "今天雾霾呢...", urls_1);

itemEntities.add(entity2);

// 3.3张图片

ArrayList urls_2 = new ArrayList();

urls_2.add("https://img-my.csdn.net/uploads/201410/19/1413698867_8323.jpg");

urls_2.add("https://img-my.csdn.net/uploads/201410/19/1413698883_5877.jpg");

urls_2.add("https://img-my.csdn.net/uploads/201410/19/1413698837_5654.jpg");

ItemEntity entity3 = new ItemEntity(//

"https://img-my.csdn.net/uploads/201410/19/1413698837_5654.jpg", "王五", "今天好大的太阳...", urls_2);

itemEntities.add(entity3);

// 4.6张图片

ArrayList urls_3 = new ArrayList();

urls_3.add("https://img-my.csdn.net/uploads/201410/19/1413698837_7507.jpg");

urls_3.add("https://img-my.csdn.net/uploads/201410/19/1413698865_3560.jpg");

urls_3.add("https://img-my.csdn.net/uploads/201410/19/1413698867_8323.jpg");

urls_3.add("https://img-my.csdn.net/uploads/201410/19/1413698837_5654.jpg");

urls_3.add("https://img-my.csdn.net/uploads/201410/19/1413698883_5877.jpg");

urls_3.add("https://img-my.csdn.net/uploads/201410/19/1413698839_2302.jpg");

ItemEntity entity4 = new ItemEntity(//

"https://img-my.csdn.net/uploads/201410/19/1413698883_5877.jpg", "赵六", "今天下雨了...", urls_3);

itemEntities.add(entity4);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值