【问题标题】:Android pick and crop image on OS 2.3Android 在 OS 2.3 上选择和裁剪图像
【发布时间】:2014-01-11 10:01:30
【问题描述】:

有什么方法可以在 2.3 上实现从内置 android 库中挑选和裁剪图像? 我找到了这个库: com.android.camera.action.CROP alternative?

但它似乎只适用于 API lvl 15 及更高版本。

【问题讨论】:

标签: android crop android-gallery


【解决方案1】:

有很多方法可以从相机中裁剪图像。 例如:通过对结果使用 Intent Activity:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

intent.putExtra(MediaStore.EXTRA_OUTPUT,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());
// ******** code for crop image
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 150);

try {

intent.putExtra("return-data", true);
startActivityForResult(intent, PICK_FROM_CAMERA);

} catch (ActivityNotFoundException e) {
// Do nothing for now
}
}

或参考这些网站以获得更多帮助:

http://www.londatiga.net/featured-articles/how-to-select-and-crop-image-on-android/ http://www.androidhub4you.com/2012/07/how-to-crop-image-from-camera-and.html

【讨论】:

    【解决方案2】:

    我使用了以下裁剪库。它真的很好,它支持2.3及以上。试试看。

    https://github.com/biokys/cropimage

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-06
      • 2015-01-23
      • 1970-01-01
      • 2013-05-19
      • 2015-02-02
      • 2015-07-09
      • 1970-01-01
      • 2019-12-20
      相关资源
      最近更新 更多