如何在android中的whatsapp上分享透明图像

时间:2014-03-22 07:25:32

标签: android

我正在尝试分享透明背景的图像。此代码仅共享图像但不透明。请在这个问题上给我更多解决方案。

Bitmap icon = ((BitmapDrawable)((ImageView)v).getDrawable()).getBitmap();
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/gif");

ContentValues values = new ContentValues();
values.put(Images.Media.TITLE, "title");
values.put(Images.Media.MIME_TYPE, "image/gif");
Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
OutputStream outstream;
try {
    outstream = getContentResolver().openOutputStream(uri);
    icon.compress(Bitmap.CompressFormat.PNG, 100, outstream);
    outstream.close();
} catch (Exception e) {
    System.err.println(e.toString());
}

share.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(share, "Share Image"));
}

0 个答案:

没有答案