0
我有一个应用程序,用户可以通过自己设置一张图片或从图库中选择一张图片来设置自己的头像。我在其他应用程序中看到,用户在选择图像后会显示一个视图,用户可以在其中“绘制”一个矩形,选择他想用作头像的图像区域。 我想在我的应用程序中包含这种可能性。拍完照后怎样才能做到这一点?如何选择一张图片来设置头像
谢谢!
编辑:
我想这个做,但它打开图片库,而不是相机:
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.setType("image/*");
cameraIntent.putExtra("crop", "true");
cameraIntent.putExtra("scale", "true");
cameraIntent.putExtra("outputX", 100);
cameraIntent.putExtra("outputY", 100);
cameraIntent.putExtra("aspectX", 1);
cameraIntent.putExtra("aspectY", 1);
cameraIntent.putExtra("max-width", 30);
cameraIntent.putExtra("max-height", 30);
cameraIntent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(cameraIntent, IMAGEN_CAMARA);
我已经试过了,但它给了我一个例外,因为它似乎没有找到作物类... – Alex