相册,多选图片,加号动态显示
来源:互联网 发布:淘宝多少天默认好评 编辑:程序博客网 时间:2024/04/30 17:54
0. onNewIntent(Intent intent) 可以接收到任意跳转到本界面的意图
显示图片界面的Activity 设置为singleTask 模式。
1.跳转到图片目录 并且携带已经选择几张图片
//
Intent intent = new Intent();
intent.setClass(this, ImgFileListActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("PictureCount", lists.size());
intent.putExtras(bundle);
startActivity(intent);
2.显示各个文件夹的目录
List<HashMap<String, String>> listdata=new ArrayList<HashMap<String,String>>();
Bitmap bitmap[] = null;
if (locallist!=null) {
bitmap=new Bitmap[locallist.size()];
for (int i = 0; i < locallist.size(); i++) {
HashMap<String, String> map=new HashMap<String, String>();
map.put("filecount", locallist.get(i).filecontent.size()+"张图片");
map.put("imgpath", locallist.get(i).filecontent.get(0)==null?null:(locallist.get(i).filecontent.get(0)));
map.put("filename", locallist.get(i).filename);
listdata.add(map);
}
}
listAdapter=new ImgFileListAdapter(this, listdata);
listView.setAdapter(listAdapter);
3. 点击跳转到相应的目录下
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Intent intent=new Intent(this,ImgsActivity.class);
Bundle bundle=new Bundle();
bundle.putParcelable("data", locallist.get(arg2));
bundle.putInt("selectpicture", selectP);
intent.putExtras(bundle);
startActivity(intent);
finish();
}
4.获取到目录下所有图片并且用gridView 显示
接收数据parce
bundle = getIntent().getExtras();
fileTraversal = bundle.getParcelable("data");
// 获取某个相册的所有图片 地址
listsP = fileTraversal.filecontent;
listsRP = new ArrayList<String>();
imgsAdapter = new ImgsAdapter(listsP, ImgsActivity.this);
imgGridView.setAdapter(imgsAdapter);
//单击事件来添加 图片到一个线性布局中 ,并且将图片的地址 加到listsRp集合内
//
for (int i = 0; i < listsP.size(); i++) {
listsBoolean.add(true);
}//用布尔类型来标记是否选择过这张图片
//点击选择图片
imgGridView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view,
int position, long arg3) {
String filapath = fileTraversal.filecontent.get(position);
if (selectpicture - select_layout.getChildCount() > 0) {
if (listsRP.size() <= 5) {
if (listsBoolean.get(position) == true) {
listsRP.add(filapath);
listsBoolean.set(position, false);
// 将这张图片添加到线性布局里面
addPictureToLinear(filapath, position);
} else {
ToastLocationUtils.toastLocalUtils(
ImgsActivity.this, "该图片已添加过");
}
} else {
ToastLocationUtils.toastLocalUtils(ImgsActivity.this,
"最多添加6张图片");
}
} else {
ToastLocationUtils.toastLocalUtils(ImgsActivity.this,
"最多选择6张图片");
}
int sPicture = selectpicture-select_layout.getChildCount();
choise_button.setText("(已选择" + select_layout.getChildCount()
+ "张图片) 还可选择(" + sPicture + ")张");
}
});
//意图将数据集合传回到发帖界面
Intent intent = new Intent(this, MyReportPost.class);
Bundle bundle = new Bundle();
bundle.putStringArrayList("files", listsRP);
intent.putExtras(bundle);
startActivity(intent);
//集合显示,刷新适配器即可
- 相册,多选图片,加号动态显示
- Android仿微信朋友圈发动态功能(相册图片多选)
- Android仿微信朋友圈发动态功能(相册图片多选)
- ANDROID GRIDVIEW仿微信图片多选功能_显示本地相册图片多选效果
- 打开相册并显示图片
- Android——点击加号从相册选取图片替换图片(缩略图)
- Android仿微信朋友圈发动态功能(相册图片多选)
- 动态加载TreeView时让TreeView节点前显示加号
- html5 调用手机相册并显示多图片
- Android:打开相册(动态布局,Activity以dialog方式显示,图片压缩)
- android图片:多选相册的实现
- iOS 相册多选 相机选择图片
- $cordovaImagePicker相册图片多选上传处理
- iOS 相册多选图片上传
- picasa相册无法显示图片的解决办法
- asp.net上传图片并显示相册
- Android 拍照/相册 获取图片裁剪显示
- android选取相册图片,适屏显示
- Java 中的 Reference
- LeetCode_Add Two Numbers
- bnu 4291 Arbitrage?
- 约瑟夫问题
- 解密H264、AAC硬件解码的关键扩展数据处理
- 相册,多选图片,加号动态显示
- Android OOM以及GC的一些建议
- HDU1856——最大连通分量的节点个数
- Vijava 学习笔记之 HostSystem 连接
- qt中的状态栏statusbar()
- Bitmap那些事之内存占用计算和加载注意事项
- 安装虚拟机如何选择网络类型?
- LeetCode —— Unique Binary Search Trees [动态规划]
- 面向对象String