【问题标题】:How to set fixed size of cropped images in Android?如何在 Android 中设置固定大小的裁剪图像?
【发布时间】:2013-07-04 07:16:49
【问题描述】:

在我的应用程序中,我们正在使用裁剪图像,但不希望裁剪区域可调整大小。图中红圈下的那些控件我不要了,应该是固定大小的

 intent.setData(mImageCaptureUri);

 intent.putExtra("outputX", 200);
 intent.putExtra("outputY", 200);
 intent.putExtra("aspectX", 1);
 intent.putExtra("aspectY", 1);
 intent.putExtra("scale", true);
 intent.putExtra("return-data", true);

【问题讨论】:

  • 这是“作物”而不是公司。
  • 它的公司先生,但我需要固定大小的公司

标签: android android-camera


【解决方案1】:

终于找到答案了

public void cropCapturedImage(Uri picUri)
    {
        // call the standard crop action intent
        Intent cropIntent = new Intent("com.android.camera.action.CROP");
        cropIntent.setDataAndType(picUri , "image/*");
        cropIntent.putExtra("crop" , "true");
        cropIntent.putExtra("return-data" , true);
        startActivityForResult(cropIntent , 2);
    }

【讨论】:

  • 在此特定情况下,此 Intent 操作 com.android.camera.action.CROP 由 AOSP 相机应用程序支持。该应用程序并非在所有设备上都存在。缺少此应用的设备将不会响应此未记录的 Intent 操作,您的应用将崩溃。
猜你喜欢
  • 2015-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-01
  • 2013-11-11
  • 2012-03-12
  • 2011-12-31
  • 2021-09-07
相关资源
最近更新 更多