Aftering captureing a layout screenshot, ImageView is transparent

Posted by Behnam on Stack Overflow See other posts from Stack Overflow or by Behnam
Published on 2012-10-06T09:36:22Z Indexed on 2012/10/06 9:37 UTC
Read the original article Hit count: 308

Filed under:
|

After capturing a layout screenshot,

Containing ImageViews pixels is semi-transparent ( it's abnormal ). Also widget that has transparent color is transparent ( it's normal ). Solid widget is not transparent ( it's normal ).

Source of imageviews is JPG files ( so no transparent pixels in the bitmap ).

Code:

final Bitmap rawBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(rawBitmap);
rendererView.layout(0, 0, width, height);
rendererView.draw(canvas);
rawBitmap.compress(CompressFormat.PNG, 100, new FileOutputStream("/sdcard/test" + System.currentTimeMillis() + ".png"));

Result:

enter image description here

© Stack Overflow or respective owner

Related posts about android

Related posts about android-layout