我尝试使用位图进行转换,但问题是这里的图像看起来像我所做的那样:
submitPhoto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
customImage.setDrawingCacheEnabled(true);
customImage.buildDrawingCache();
//Bitmap bit =Bitmap.createBitmap(customImage.getWidth(), customImage.getHeight(),Bitmap.Config.ARGB_8888);
//Canvas canvas = new Canvas(bit);
//personPhoto.draw(canvas);
Bitmap bitmap=Bitmap.createBitmap( customImage.getDrawingCache());
customImage.setDrawingCacheEnabled(false);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
Intent intent=new Intent(OnPhotoTakedActivity.this,OnPhotoSubmit.class);
intent.putExtra("bitmap",scaleDownBitmap(bitmap,120,getApplicationContext()));
startActivity(intent);
}
});
并在下一个活动中:
Intent intent = getIntent();
Bitmap bitmap=intent.getExtras().getParcelable("bitmap");
imageView.setImageBitmap(bitmap);
我在这个和其他网站上尝试了所有代码,但图像仍然很糟糕 谢谢你。