Aftering captureing a layout screenshot, ImageView is transparent
- by Behnam
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: