2014-12-04 65 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.

相关问题