Cant get gradient backgrounds to look good?
I've tried everything, and se开发者_运维知识库arched the whole web, but still, nothing works.
Here is the background my designer designed:And here how it looks on my screen (Galaxy S I9000):
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?
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" />
精彩评论