您当前的位置: 首页 >  android

android ImageSelector 仿微信朋友圈选择图片

发布时间:2017-08-22 14:10:56 ,浏览量:0

ImageSelector
项目地址: ioneday/ImageSelector
简介:Photo picker library for Android. Support single choice、multi-choice、cropping image and preview image.
更多: 作者    提 Bug   
标签:

Image selector library for Android. Support single choice、multi-choice、cropping image and preview image.

  

 

Quick start

1) Add Library module as a dependency in your build.gradle file.

or

dependencies {
    compile 'com.android.support:recyclerview-v7:22.2.1'
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.commit451:PhotoView:1.2.4'
    compile 'com.isseiaoki:simplecropview:1.0.13'
    compile 'com.yongchun:com.yongchun.imageselector:1.1.0'
}

2) Declare permission in your AndroidManifest.xml



			

3) Call ImageSelectorActivity in your code

ImageSelectorActivity.start(MainActivity.this, maxSelectNum, mode, isShow,isPreview,isCrop);

same this

public static void start(Activity activity, int maxSelectNum, int mode, boolean isShow, boolean enablePreview, boolean enableCrop) {
    Intent intent = new Intent(activity, ImageSelectorActivity.class);
    intent.putExtra(EXTRA_MAX_SELECT_NUM, maxSelectNum);
    intent.putExtra(EXTRA_SELECT_MODE, mode);
    intent.putExtra(EXTRA_SHOW_CAMERA, isShow);
    intent.putExtra(EXTRA_ENABLE_PREVIEW, enablePreview);
    intent.putExtra(EXTRA_ENABLE_CROP, enableCrop);
    activity.startActivityForResult(intent, REQUEST_IMAGE);
}

4) Receive result in your onActivityResult Method

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(resultCode == RESULT_OK && requestCode == ImageSelectorActivity.REQUEST_IMAGE){
        ArrayListimages = (ArrayList) data.getSerializableExtra(ImageSelectorActivity.REQUEST_OUTPUT);
        // do something
    }
}
Thanks
  • Glide

  • PhotoView

  • simplecropview

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    110950博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0500s