Android 仿微信 相册多图选择器

下载方式

1<dependency> 2 <groupId>com.sh.zsh.code</groupId> 3 <artifactId>shphotoselectorlibrary</artifactId> 4 <version>2.0.9</version> 5 <type>pom</type> 6</dependency>

or Gradle:

compile 'com.sh.zsh.code:shphotoselectorlibrary:2.0.9'

该项目依赖 Glide:3.7.0 如果有冲突 可以 修改主项目里的依赖 或者 直接导入Library

###跳转到 图片选择器页面

1public static final int IMGSACTIVITY_REQUEST = 10001; 2 public void chise(View v) { 3 4 Intent intent = new Intent(); 5 intent.putExtra(PhotoActivity.IMAGE_COUNT,9); //可选择图片的最大数量 6 intent.putExtra(PhotoActivity.BAR_COLORS,R.color.colorPrimary);//顶部Toolbar栏背景颜色 7 intent.setClass(this,PhotoActivity.class); 8 startActivityForResult(intent,IMGSACTIVITY_REQUEST); 9 }

###在Activity的回调里获取到 所有选择的图片地址

1@Override 2 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 3 if (requestCode == IMGSACTIVITY_REQUEST && resultCode == RESULT_OK) { 4 Bundle bundle = data.getExtras(); 5 6 if (bundle != null) { 7 if (bundle.getStringArrayList("files") != null) { 8 listfile = bundle.getStringArrayList("files"); 9 listView.setVisibility(View.VISIBLE); 10 ArrayAdapter<String> arryAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listfile); 11 listView.setAdapter(arryAdapter); 12 } 13 } 14 } 15 }

###效果

源码地址:https://github.com/hui46226021/ShPhotoSelector

点赞
收藏

评论区

加载中...

相关推荐

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

springboot接入微信app支付

一:集成步骤1.引入依赖:<dependency<groupIdcom.github.wxpay</groupId<artifactIdwxpaysdk</artifactId<version0.0.3</version</dependency

java读取XML

方法不在多,能用就好。我采用的是dom4j<dependency<groupIddom4j</groupId<artifactIddom4j</artifactId<version1.6.1</version</dependency读取的文件内容

SpringBoot权限管理开发实战2

1.添加依赖<dependency<groupIdorg.mybatis.spring.boot</groupId<artifactIdmybatisspringbootstarter</artifactId<version2.1.1</version</dependency<dependency<groupI

Spring Test 整合 JUnit 4 使用总结

1\.加入依赖包<dependency<groupIdjunit</groupId<artifactIdjunit</artifactId<version4.9</version

Springmvc 发送邮件功能

1、引入相关jar包<dependency<groupIdorg.apache.velocity</groupId<artifactIdvelocity</artifactId<version1.7</version</dependency