I'm working on a Gingerbread (2.3.3) device. I have an ImageView which contains an arrow figure and have a fully transparent background which I need to draw on some background. The problem is that there's a "shading" artifact beneath the ImageView's bounding box.
If you look closely on the following image, you'll see the artifact i'm talking about: 1
Both the foreground image and the background image have alpha channels and therefore are decoded as ARGB8888 (I double checked this by manually decoding their resources into a bitmap, print out the bitmap configuration which showed ARGB8888, and then assigning them to their respective views). I also configured the Activitiy's window to be PixelFormat.RGBA_8888 before the call to setContentView().
Please don't refer me to threads that suggest decoding the bitmap as ARGB8888 and/or set the window to be RGBA_8888, since I tried both solutions, which didn't help.
Any ideas how can I fix this issue?
EDIT:
Here's the function which sets the Window pixel format and drawables (called directly from onCreate()):
public void testTransparency() { getWindow().setFormat(PixelFormat.RGBA_8888); setContentView(R.layout.transparency_test); LinearLayout ll = (LinearLayout)findViewById(R.id.ll); Bitmap bgBmp = BitmapFactory.decodeResource(getResources(), R.raw.bg); Log.d(TAG,"BG BMP Config: " + bgBmp.getConfig()); ll.setBackgroundDrawable(new BitmapDrawable(bgBmp)); ImageView iv = (ImageView)findViewById(R.id.iv); iv.setBackgroundDrawable(null); Bitmap arrowBmp = BitmapFactory.decodeResource(getResources(), R.raw.big_arrow); Log.d(TAG,"Arrow BMP Config: " + arrowBmp.getConfig()); iv.setImageBitmap(arrowBmp); }
And here's the (very simple) layout my test is using:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView android:id="@+id/iv"
android:layout_width="72dp"
android:layout_height="120dp"
/></LinearLayout>
The 'bg' resource can be found at 2
The 'big_arrow' resource can be found at "http://i.imgur.com/3V6QU.png"
EDIT 2:
I found out I can't reproduce the problem on the emulator, nor on my N1 (2.3.4) or XOOM (3.2.1). There are 2 options continuing from here:
1. The problem is device specific (Android based appliance i'm working on)
2. There's a specific problem with 2.3.4 and 32BPP framebuffer while rendering transparent PNGs on top of each other.
Thanks.