Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant get gradient backgrounds to look good?

Tags:

android

screen

I've tried everything, and searched the whole web, but still, nothing works.
Here is the background my designer designed:
enter image description here

And here how it looks on my screen (Galaxy S I9000):
enter image description here

I've tried to enable dithering with this code:

findViewById(R.id.LinearLayout_Main).getBackground().setDither(true);
    @Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Window window = getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
}

Can anyone tell me why?

like image 548
Omar Avatar asked Oct 03 '11 18:10

Omar


1 Answers

I think, this article will be interesting for you:

Android perfect UI: fighting with dithering

And you can read about dithering background here on SO too

android:dither="true" does not dither, what's wrong?

And last suggestion comes from Android Google Groups

https://groups.google.com/group/android-developers/browse_thread/thread/aebef48635d04334/2e3d86e62e0452e5?lnk=gst&q=dithering#2e3d86e62e0452e5

to use gradient proxy drawable shape instead of @drawable/image like this:

<?xml version="1.0" encoding="utf-8"?> 
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:src="@drawable/image" 
    android:dither="true" /> 
like image 86
Marek Sebera Avatar answered Nov 13 '22 02:11

Marek Sebera