I convert a view in a bitmap using drawing cache. But when I use a 
transparent background in the view, the bitmap doesn't show. The code:

//View v = inflate etc.
v.setDrawingCacheEnabled(true);
v.setLayoutParams(new 
LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
RelativeLayout.LayoutParams.WRAP_CONTENT));
v.measure(
    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
v.buildDrawingCache(true);

if (v.getDrawingCache() != null) {
bitmap = Bitmap.createBitmap(v.getDrawingCache());
}


This works as long as I use an opaque color as background of my view, like:

android:background="#ffffff"

But as soon I put some transparency, like

android:background="#88ffffff"

or don't use background at all, the bitmap doesn't show anything (there are 
some other views with content inside, which should show).

I also tried adding this line:

v.setDrawingCacheBackgroundColor(0x00000000);

with some different colors. No effect.

I need a transparent background for this view. What do I do to get it also 
in the bitmap?


Thanks in advance.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to