1

I use a linear background (xml shape) as the actionbar background in android 4.0. It does not display well, looks banded.

How to make it render smooth?

virsir
  • 14,359
  • 23
  • 71
  • 108

3 Answers3

2

First, I'm assuming you're using the default RGBA_8888 pixel format (default as of Android 2.3). Second, on some displays gradients render poorly. One workaround is to overlay a small bit of noise over the gradient (a repeating semi-transparent noise texture in drawable-nodpi should do) using a <layer-list> drawable.

Roman Nurik
  • 29,417
  • 7
  • 81
  • 82
1

Try increasing PixelFormat quality of a window:

@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    getWindow().setFormat(PixelFormat.RGBA_8888);
}

This is possibly a duplicate of this question.

Community
  • 1
  • 1
vArDo
  • 4,387
  • 1
  • 15
  • 26
0

Is it a repeating pattern (tiled) or a nine patch? ICS is having some issues with certain types of rendering since it is by default drawing using hardware acceleration which makes it impossible to use some drawing techniques (specially when Drawables) and generates undesired results with some others. You can see some explanation and a list here.

Fortunately there are solutions or workarounds to most of them. Just need to know which exact kind of element are you using to draw your background.

Jose L Ugia
  • 5,572
  • 3
  • 21
  • 26