[英]How to Crop Images without using Intent in Android
I am trying to crop an image I have used the code below 我正在尝试裁剪我使用下面代码的图像
Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent i = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); i.putExtra("crop", "true");
i.putExtra(“crop”,“true”);
startActivityForResult(i, 1);startActivityForResult(i,1);
But i have to do crop image without using Intent. 但我必须在不使用Intent的情况下裁剪图像。 And also have to customize the croping UI.
并且还必须自定义裁剪UI。 please help me out how to do that.
请帮我解决这个问题。
I am not supposed to use new Intent("com.android.camera.action.CROP");
我不应该使用
new Intent("com.android.camera.action.CROP");
with Thanks 谢谢
Vikash Vikash
您可以使用createBitmap()来提取当前位图的子集。
take a look at the following link. 看看以下链接。 Should provide a good stepping stone to step up a ui with pinch to zoom and scroll and finally once you have what you want you can use a second view as your crop region.
应该提供一个很好的垫脚石来加强ui与捏缩放和滚动,最后一旦你有你想要的你可以使用第二个视图作为你的裁剪区域。 depends on what your looking for otherwise createBitmap option also works.
取决于你在寻找什么,否则createBitmap选项也有效。 http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
View view = findViewById(R.id.crop_region);
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap cropBitmap = view.getDrawingCache();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.