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, 开发者_如何学Pythonand 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.
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.
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.
精彩评论