打开app的gradle,在dependencies节点下添加:
compile 'com.soundcloud.android.crop:lib_crop:1.0.0'
然后,我们在选择图片返回数据后,获取数据,然后调用图片裁剪工具的方法,调用的时候,我们需要在清单文件中注册裁剪功能所在的页面:
<activity android:name="com.soundcloud.android.crop.CropImageActivity"/>
在代码中调用方法:
/**
* 掉用裁剪方法
*
* @param headFile
*/
public void toChoice(Uri headFile) {
Crop.of(headFile, Uri.fromFile(
new File(StorageUtils.getCacheDir(this) + "/jjjj.png"))).asPng(true)
.asSquare().withAspect(300, 300).withMaxSize(600, 800).start(this);
}