I’m trying to add a background that includes a gradient (I do want to use an image, not an android xml declared gradient effect).
This image is remarkably ruined by Android, it add some crappy banding whatever I try the result is the same (two capture of approximately the same region the distorted/normal images) :

My image is used as a layout background inside my layout XML :
android:background="@drawable/background_gradient_dithered"
I’ve tried to used an intermediate drawable to force dither whose xml is :
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/background_gradient" android:dither="true" android:antialias="true" android:filter="true"/>
I’ve tried to have the following code in my onCreate() :
getWindow().setFormat(PixelFormat.RGBA_8888);
Both tries changed nothing.
Thanks
The correct solution was …. I bet you’ve guess it : restarting Eclipse. I’ve learned it, every problem on Android might be a “restart Eclipse problem”.
After some test I can add that enabling dethering is not useful when Format is set to PixelFormat.RGBA_8888
Readers should give a look to the answer given by @TenFour04, this approach can avoid to make drawable just to enable dithering.
EDIT :
I’ve found out that even with these tricks the problem can persist. You can try to modifiy your PNG to have an alpha layer in it (change a pixel to a transparency of 99% for example), this would force android compiler to not play with it.