无法获得渐变背景看起来不错?

Oma*_*mar 9 android screen

我已经尝试了一切,并搜索了整个网络,但仍然没有任何作用.
这是我的设计师设计的背景:
在此输入图像描述

在这里它在我的屏幕上看起来如何(Galaxy S I9000):
在此输入图像描述

我试图用这段代码启用抖动:

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

谁能告诉我为什么?

Mar*_*era 5

我想,这篇文章对你很有意思:

Android完美UI:与抖动战斗

你也可以在这里阅读有关抖动背景的信息

android:dither ="true"没有抖动,有什么不对?

最后的建议来自Android Google网上论坛

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

使用gradient proxy drawable shape而不是@drawable/image像这样:

<?xml version="1.0" encoding="utf-8"?> 
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:src="@drawable/image" 
    android:dither="true" /> 
Run Code Online (Sandbox Code Playgroud)