Android's gradient drawables: poor quality of screenshots in Eclipse

android, android-drawable, eclipse, gradient

Solution

Just to make sure everyone who reads this question sees the solution:

As davehale23 and Chris Stratton pointed out, the problem is not Eclipse or the app being "photographed". The problem is the Android emulator, which obviously uses a reduced bit depth.

So if one takes screenshots of an app, one should always use a real device.

Problem

I'm using drawables like the following one for backgrounds with a gradient: ``` <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#ffffff" android:endColor="#cccccc" android:angle="-90" android:dither="true" /> </shape> ``` This results in a banded gradient on the emulator, and when I take a screenshot of the emulator (using Eclipse), the result is even poorer: Why? And how to solve this problem? It is although I'm using `android:dither="true"` in the drawables' XML and setting this in the `Activity`'s `onCreate()`: ``` getWindow().setFormat(PixelFormat.RGBA_8888); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER); ``` By the way, the blue part is the native action bar and the grey gradients are `ListView` rows with the background drawable.

Original source

Related problems