Yalantis / uCrop

Image Cropping Library for Android
https://yalantis.com/blog/introducing-ucrop-our-own-image-cropping-library-for-android/
11.85k stars 2.16k forks source link

How can I use the Freestyle crop? #788

Closed Superbia-zyb closed 2 years ago

Superbia-zyb commented 2 years ago

[UCrop.of( photoUri, Uri.parse(newUri)) .start(PhotoDisplay.this);] This code only gives me some options like "1:1" "3:2" and so on 。But I want to change the proportion freely 。How can I do this ?

Superbia-zyb commented 2 years ago

I will close this issue because i find the resolution. ` UCrop uCrop = UCrop.of(uri,destinationUri);

    UCrop.Options options = new UCrop.Options();

    options.setAllowedGestures(UCropActivity.SCALE, UCropActivity.ROTATE, UCropActivity.ALL);

    //设置隐藏底部容器,默认显示
    options.setHideBottomControls(true);

    //设置toolbar颜色
    options.setToolbarColor(ActivityCompat.getColor(this, R.color.colorPrimary));

    //设置状态栏颜色
    options.setStatusBarColor(ActivityCompat.getColor(this, R.color.colorPrimary));

    //是否能调整裁剪框
    options.setFreeStyleCropEnabled(true);

    uCrop.withOptions(options);

    uCrop.start(this);`