{
    分享网正式开通,我们为大家提供免费资源,欢迎大家踊跃投稿!

Android 图片裁剪库 uCrop

uCrop 是[Yalantis](https://yalantis.com/) 组织开源的图片裁剪库, 支持缩放, 旋转图片, 支持各种比例的裁剪框, 非常强大的一个图片裁剪库。

使用

1. 添加包.

compile 'com.yalantis:ucrop:1.3.+'

2.    注册 UCropActivity 在 AndroidManifest.xml中

    <activity
        android:name="com.yalantis.ucrop.UCropActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

3. 代码设置

    UCrop.of(sourceUri, destinationUri)
        .withAspectRatio(169)
        .withMaxResultSize(maxWidth, maxHeight)
        .start(context);

4. 实现继承的方法  

 @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK && requestCode == UCrop.REQUEST_CROP) {
            final Uri resultUri = UCrop.getOutput(data);
        } else if (resultCode == UCrop.RESULT_ERROR) {
            final Throwable cropError = UCrop.getError(data);
        }
    }

资源均来自第三方,谨慎下载,前往第三方网站下载


爱资源分享网 , 版权所有丨本站资源仅限于学习研究,严禁从事商业或者非法活动!丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Android 图片裁剪库 uCrop
喜欢 ()分享 (0)