views:

46

answers:

2

I have a gray gradient drawable (png image in res/drawable). If I draw it on a white Canvas it looks banded (not smooth). If I put the gradient on white background in GIMP, and then draw this drawable on the Canvas, it looks great. What's the problem? I tested this on Nexus One. Calling setDither(true) on the drawable has no noticable effect.

A: 

This is something that's been frustrating me as well. I've found that saving as a 24-bit BMP eliminates the problem, but that's not really a solution if you need transparency. I don't really understand why a 24-bit PNG has the problem while the 24-bit BMP doesn't.

kcoppock
A: 

This does the trick:

Window.setFormat(PixelFormat.TRANSLUCENT);

Found here: http://stuffthathappens.com/blog/2010/06/04/android-color-banding/

I hope it doesn't have any negative sideeffects.

fhucho