2011-10-03 53 views
8

我试过了一切,并搜索了整个网页,但仍然没有任何工作。
这里是我的背景设计设计师:
enter image description here无法获得渐变背景看起来不错?

在这里,它的外观我的屏幕(Galaxy S的I9000)上:
enter image description here

我试图使这个代码抖动:

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

谁能告诉我为什么?

回答

5

我想,这篇文章会为你是有趣:

Android perfect UI: fighting with dithering

而且你可以阅读关于所以也

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

而最后一个建议来自安卓这里抖动背景Google Groups

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" />