2011-10-03 54 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" />