Android 仿微信 相册多图选择器
生活随笔
收集整理的這篇文章主要介紹了
Android 仿微信 相册多图选择器
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
為什么80%的碼農都做不了架構師?>>>
下載方式
<dependency><groupId>com.sh.zsh.code</groupId><artifactId>shphotoselectorlibrary</artifactId><version>2.0.9</version><type>pom</type> </dependency>or Gradle:
compile 'com.sh.zsh.code:shphotoselectorlibrary:2.0.9'該項目依賴 Glide:3.7.0 如果有沖突 可以 修改主項目里的依賴 或者 直接導入Library
###跳轉到 圖片選擇器頁面
public static final int IMGSACTIVITY_REQUEST = 10001;public void chise(View v) {Intent intent = new Intent();intent.putExtra(PhotoActivity.IMAGE_COUNT,9); //可選擇圖片的最大數量intent.putExtra(PhotoActivity.BAR_COLORS,R.color.colorPrimary);//頂部Toolbar欄背景顏色intent.setClass(this,PhotoActivity.class);startActivityForResult(intent,IMGSACTIVITY_REQUEST);}###在Activity的回調里獲取到 所有選擇的圖片地址
@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) {if (requestCode == IMGSACTIVITY_REQUEST && resultCode == RESULT_OK) {Bundle bundle = data.getExtras();if (bundle != null) {if (bundle.getStringArrayList("files") != null) {listfile = bundle.getStringArrayList("files");listView.setVisibility(View.VISIBLE);ArrayAdapter<String> arryAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listfile);listView.setAdapter(arryAdapter);}}}}###效果
源碼地址:https://github.com/hui46226021/ShPhotoSelector
轉載于:https://my.oschina.net/zhushihui/blog/856855
總結
以上是生活随笔為你收集整理的Android 仿微信 相册多图选择器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 初识Oracle的XMLType
- 下一篇: Junit Hamcrest Ecl