2014-12-04 29 views

回答

1

您可以使用相機意圖裁剪動作。如果用戶設備不支持裁剪意圖,他們將看到一條錯誤消息。裏面的 「嘗試」 塊,如下啓動意圖:

 //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.

相關問題