交互美到炸的图片选择器

Matisse,是一款由知乎开源的媒体选择器。

1.支持JPEG,PNG,GIF的图片选择和MPEG,MP4格式的视频选择。不能同时选择图片和视频

2.两种主题可供选择,因为知乎也是两种主题,图片Loader,自定义过滤条件


#### 在gradle中使用

```

repositories {   

 jcenter()

}

dependencies {   

 compile'com.zhihu.android:matisse:0.4.3'

}

```

#### Permission

`

The library requires two permissions:

android.permission.READ_EXTERNAL_STORAGE

android.permission.WRITE_EXTERNAL_STORAGE

`


> Java代码中使用

```

Matisse.from(MainActivity.this).choose(MimeType.ofAll()).countable(true).maxSelectable(9).addFilter(new GifSizeFilter(320,320,5* Filter.K* Filter.K)).gridExpectedSize(

getResources().getDimensionPixelSize(R.dimen.grid_expected_size)).restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT).thumbnailScale(0.85f).imageEngine(new GlideEngine()).forResult(REQUEST_CODE_CHOOSE);

```

```

ListmSelected;@OverrideprotectedvoidonActivityResult(intrequestCode,intresultCode, Intent data) {super.onActivityResult(requestCode, resultCode, data);if(requestCode == REQUEST_CODE_CHOOSE && resultCode == RESULT_OK) {mSelected = Matisse.obtainResult(data);Log.d("Matisse","mSelected: "+ mSelected);}}

```

你可能感兴趣的:(交互美到炸的图片选择器)