0
如何在Android中創建類似QuickPic的裁剪工具,我們可以移動和縮放要裁剪的圖像?如何在Android中創建類似QuickPic應用程序的裁剪工具?
我們需要能夠移動圖像以及裁剪框。我們是否需要使用畫布來實現這個?
或者我們可以移動另一個對象嗎?有關如何開始的任何建議或鏈接將受到讚揚。
我已經使用android-crop庫,但沒有得到我想要實現的。
如何在Android中創建類似QuickPic的裁剪工具,我們可以移動和縮放要裁剪的圖像?如何在Android中創建類似QuickPic應用程序的裁剪工具?
我們需要能夠移動圖像以及裁剪框。我們是否需要使用畫布來實現這個?
或者我們可以移動另一個對象嗎?有關如何開始的任何建議或鏈接將受到讚揚。
我已經使用android-crop庫,但沒有得到我想要實現的。
您可以使用相機意圖裁剪動作。如果用戶設備不支持裁剪意圖,他們將看到一條錯誤消息。裏面的 「嘗試」 塊,如下啓動意圖:
//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);