Martin
Martin

Reputation: 61

Noise effect on Android background

A lot of new Android applications I've been seeing are using a noise effect on their backgrounds, usually a gradient. What interesting is that some applications use radiel gradients throughout their application with this effect, which would require a lot of disk space for the images. Now Android has GradientDrawable which can create gradients very easily. I was thinking about creating the noise effect programmatically.

Has anyone else done this before and if so, how did you go about it? Did you just use an image or write your own custom noise overlay?

Upvotes: 6

Views: 1861

Answers (1)

Chris
Chris

Reputation: 7853

If you just want to eleminate the Color Banding programmaticaly you can do so by overiding the onAttachedToWindow() callback of your activity like this:

@Override
public void onAttachedToWindow() {
  super.onAttachedToWindow();
  Window window = getWindow();
  // Eliminates color banding
  window.setFormat(PixelFormat.RGBA_8888);
}

This worked very well for my normal applications. I didn't test this with widdgets yet.

Upvotes: 1

Related Questions