com.android.camera.action.CROP 图片剪裁问题 图片剪裁 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //不知道下面方法是不是你需要的,你自己可以试试 // Save the image to a temp file and invoke the cropper { byte[] data;//图片数据 Uri tempUri = null; FileOutputStream tempStream = null; try { File path = getFileStreamPath("crop-temp"); path.delete(); tempStream = openFileOutput("crop-temp", 0); tempStream.write(data); tempStream.close(); tempUri = Uri.fromFile(path); } catch (FileNotFoundException ex) { setResult(Activity.RESULT_CANCELED); finish(); return; } catch (IOException ex) { setResult(Activity.RESULT_CANCELED) finish(); return; } finally { } Bundle newExtras = new Bundle(); Intent cropIntent = new Intent("com.android.camera.action.CROP"); cropIntent.setData(tempUri); cropIntent.putExtras(newExtras); startActivityForResult(cropIntent, CROP_MSG); } @Override protected void onActivityResult( int requestCode, int resultCode, Intent data) { switch (requestCode) { case CROP_MSG: { setResult(resultCode, data); finish(); File path = getFileStreamPath("crop-temp"); //op path.delete(); break; } } } http://stackoverflow.com/questions/9388209/android-cropping-an-image-to-specific-sizeIntent intent = new Intent(Intent.ACTION_GET_CONTENT, null) .setType("image/*") .putExtra("crop", "true") .putExtra("aspectX", width) .putExtra("aspectY", height) .putExtra("outputX", width) .putExtra("outputY", height) .putExtra("scale", true)//黑边 .putExtra("scaleUpIfNeeded", true)//黑边 .putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f)) .putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());大尺寸http://www.cnblogs.com/jun-it/articles/2881826.html#commentform 真心有用啊 谢谢楼主 谢谢ccsosnfs 关于Android闹钟的一个问题 关于Android播h264的视频 要写一个短消息界面 想参考下安桌自带短信界面 相关源码怎么获取? 移植WIFI 音乐无法重放 有关StatusBarManager 【百分求助】4.0中WebView的使用,在线等,急。跪求解答 安装apk时报INSTALL_PARSE_FAILED_NO_CERTIFICATES错误 实现室内地图展示而且区域可点击效果 求助帖!关于C# mono开发 发布一个开源的Android软件,将手机变成IP Camera的程序 Wireshark 抓包 问题
// Save the image to a temp file and invoke the cropper
{ byte[] data;//图片数据
Uri tempUri = null;
FileOutputStream tempStream = null;
try {
File path = getFileStreamPath("crop-temp");
path.delete();
tempStream = openFileOutput("crop-temp", 0);
tempStream.write(data);
tempStream.close();
tempUri = Uri.fromFile(path);
} catch (FileNotFoundException ex) {
setResult(Activity.RESULT_CANCELED);
finish();
return;
} catch (IOException ex) {
setResult(Activity.RESULT_CANCELED)
finish();
return;
} finally {
} Bundle newExtras = new Bundle();
Intent cropIntent = new Intent("com.android.camera.action.CROP"); cropIntent.setData(tempUri);
cropIntent.putExtras(newExtras); startActivityForResult(cropIntent, CROP_MSG);
}
@Override
protected void onActivityResult(
int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case CROP_MSG: {
setResult(resultCode, data);
finish(); File path = getFileStreamPath("crop-temp");
//op
path.delete(); break;
}
}
}
.setType("image/*")
.putExtra("crop", "true")
.putExtra("aspectX", width)
.putExtra("aspectY", height)
.putExtra("outputX", width)
.putExtra("outputY", height)
.putExtra("scale", true)//黑边
.putExtra("scaleUpIfNeeded", true)//黑边
.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f))
.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
大尺寸
http://www.cnblogs.com/jun-it/articles/2881826.html#commentform