I've been struggling to get gradients to appear smooth on my LG G Watch running Android 5.0.1.
Before you mark as a duplicate, I have tried every answer for several posts (like Why android lose image quality when displaying a png file?, Is it possible to dither a gradient drawable?, android:dither="true" does not dither, what's wrong?, Color Banding Android Solution, Color banding and artifacts with gradients despite using RGBA_8888 everywhere, Color banding only on Android 4.0+, Awful background image quality in Android), but none seem to apply.
Here are my steps for creating a gradient
1) Load Sample 'Wearable: Watch View Stub' project from the latest Android SDK
2) Change the rect_background.xml
drawable to:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/rect_corner_radius"/>
<gradient android:startColor="@color/light_grey"
android:endColor="@color/white"
android:angle="90"/>
</shape>
3) Here is what it looks like on the emulator
4) Here's what it looks like when I do a screen capture from the device:
5) But when I look at it in person, there is terrible banding: (it looks far worse in real life; the image doesn't do it justice)
The following is a simulated image of what it looks like in person (128 colors):
I have also tried:
- Using a png bitmap (24-bit)
- Using a png bitmap with 1 transparent pixel (32-bit)
- Using a png bitmap with all semi-transparent pixels (32-bit)
- Using a png bitmap with reduced bit-depth (256 colors)
Using a jpeg with 100 quality.
Manually setting PixelFormat to RGBA_8888 in Activity before and after create layout
- Turning on dithering in the activity
- Loading the bitmap from code using a custom bitmap loader (setting pixel format, dithering, etc., see Awful background image quality in Android)
- Turning off any sort of scaling for the ImageView
- Putting the image in drawable, drawable-hdpi, and raw folders
- Unzipping the APK and verifying that the image was uncompressed.
All of these show up the same way.
How do I get this to appear correctly on the device?
Is anyone else seeing this issue? According to this site, the LG G Watch has a color-depth or 24-bit, which should be full 8 bits per channel. Normal images on the device appear correct--no noticeable banding.