How to draw a smooth/dithered gradient on a canvas in Android

Posted by André on Stack Overflow See other posts from Stack Overflow or by André
Published on 2010-05-29T22:29:15Z Indexed on 2010/05/29 22:32 UTC
Read the original article Hit count: 429

Filed under:
|
|

Several answers mention to use GradientDrawable.setDither(true) to draw smooth gradients in Android. That has no effect in my code. Any idea what I have to change to get a well looking gradient in my live wallpaper?

GradientDrawable gradient = new GradientDrawable(Orientation.TL_BR, colors);
gradient.setGradientType(GradientDrawable.RADIAL_GRADIENT);
gradient.setGradientRadius(canvas.getWidth() * 2);
gradient.setDither(true);g
gradient.setGradientCenter(-0.1f, -0.1f);
gradient.setBounds(cb);
gradient.draw(canvas);

© Stack Overflow or respective owner

Related posts about android

Related posts about gradient