我想模仿系统图库的裁剪功能作为图片http://i.6.cn/cvbnm/88/4a/be/94d8630ca9a3261154f0acf2ebd9f39d.png,我在Gallery \ src \ com \ android \ camera找到了源代码,但是我无法在一张图片上添加编辑矩形,我知道编辑矩形是在HighlightView.jave文件中完成的。你告诉我如何在图片上添加一个编辑矩形,它可以像编辑矩形一样缩放和移动
答案 0 :(得分:1)
1.消防意图
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
intent.putExtra("crop", "true");
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(IMAGE_PATH_TO_SAVE_CROPPED_IMAGE)));
startActivityForResult(Intent.createChooser(intent, "Select Picture"), RETURN_CODE);
2.然后在onActivityResult
Bitmap bitmap = BitmapFactory.decodeFile(IMAGE_PATH_TO_SAVE_CROPPED_IMAGE);
// bitmap will contain the cropped image