Coder Social home page Coder Social logo

pictureselector's Introduction

使用方式:

步骤一、 在project的 build.Gradle 中添加仓库

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

步骤二、 添加依赖

dependencies { implementation 'com.github.ytf12138:PictureSelector:v1.2' }

在代码中的调用:

只用一行代码搞定:

PictureSelector.getInstance()
                        .setTitle("图片选择")//设置标题
                        .setMaxCount(9)//设置最大选择数量
                        .setShowImage(true)//是否显示图片,默认true
                        .setShowVideo(true)//是否显示视频,默认false
                        .setSelectType(false)//是否能同时选择图片和视频,默认false
                        .setShowCamera(false)//是否显示拍照item,默认false
                        .start(MainActivity.this, 1);//设置回调时 requestCode

选择结果的接收: 在 Activity 的回调方法中:

@Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        if (requestCode == 1 && resultCode == RESULT_OK) {
           ArrayList<String> arrayList = data.getStringArrayListExtra(PictureSelector.SELECT_ITEM);
        }
    }

arrayList 中保存着选中的图片路径

pictureselector's People

Contributors

ytf12138 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.