2011-10-03 36 views
8

Tôi đã thử mọi thứ và tìm kiếm trên toàn bộ web nhưng vẫn không có tác dụng gì.
Dưới đây là nền tảng thiết kế của tôi thiết kế:
enter image description hereKhông nhận được nền gradient để trông đẹp?

Và đây nó trông như thế trên màn hình của tôi (Galaxy S I9000):
enter image description here

tôi đã cố gắng để cho phép phối màu với mã này:

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

Bất cứ ai có thể cho tôi biết lý do không?

Trả lời

5

Tôi nghĩ rằng, bài viết này sẽ rất thú vị dành cho bạn:

Android perfect UI: fighting with dithering

Và bạn có thể đọc về phối màu nền ở đây trên SO quá

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

Và đề nghị mới nhất đến từ Android Google Groups

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

sử dụng gradient proxy drawable shape thay vì @drawable/image như thế này:

<?xml version="1.0" encoding="utf-8"?> 
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:src="@drawable/image" 
    android:dither="true" /> 
Các vấn đề liên quan