【问题标题】:How to create cropping tool like QuickPic app in android ?如何在 android 中创建像 QuickPic 应用程序这样的裁剪工具?
【发布时间】:2014-12-04 14:28:38
【问题描述】:

如何在android中创建像QuickPic这样的裁剪工具,我们可以在其中移动和缩放要裁剪的图像?

我们需要能够移动图像以及裁剪框。我们需要使用画布来实现吗?

或者我们可以在另一个对象上移动一个对象吗?任何关于如何开始的建议或链接都​​将受到表扬。

我使用了android-crop 库,但没有得到我想要的结果。

【问题讨论】:

    标签: android android-canvas android-imageview crop pinchzoom


    【解决方案1】:

    您可以使用相机意图裁剪操作。如果用户设备不支持裁剪 Intent,他们将看到一条错误消息。在“try”块中,按如下方式启动 Intent:

            //call the standard crop action intent (the user device may not support it)
    Intent cropIntent = new Intent("com.android.camera.action.CROP"); 
        //indicate image type and Uri
    cropIntent.setDataAndType(picUri, "image/*");
        //set crop properties
    cropIntent.putExtra("crop", "true");
        //indicate aspect of desired crop
    cropIntent.putExtra("aspectX", 1);
    cropIntent.putExtra("aspectY", 1);
        //indicate output X and Y
    cropIntent.putExtra("outputX", 256);
    cropIntent.putExtra("outputY", 256);
        //retrieve data on return
    cropIntent.putExtra("return-data", true);
        //start the activity - we handle returning in onActivityResult
    startActivityForResult(cropIntent, PIC_CROP);
    

    You can refer to this link for more details.

    【讨论】:

      猜你喜欢
      • 2011-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 1970-01-01
      • 2011-11-17
      • 2017-11-21
      相关资源
      最近更新 更多