uCrop Android 图片裁剪库

程序名称:uCrop

授权协议: Apache

操作系统: Android

开发语言: Java

uCrop 介绍

ucropYalantis 组织开源的图片裁剪库, 支持缩放, 旋转图片, 支持各种比例的裁剪框,
非常强大的一个图片裁剪库。

使用

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(16, 9)
        .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);
        }
    }

uCrop 官网

https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/

相关编程语言

BBGestureBack Full screen return gesture(全屏手...
Framework7 或者叫 F7 是全功能的绑定 iOS 7 应用的...
iOS 调试库,支持 iOS8+,无需添加任何代码,方便 i...
DarkModeKit是在Apple官方的深色模式发布之前设计和...
SimpleNote iOS 版客户端。SimpleNote 是一款在多平...
Kivy iOS,此工具旨在为 iOS 编译必要的库以运行应用...