How to apply RGBA_8888 and dither correctly?
<p>I have splash.png with gradient. But on screen this image looks not so good ...</p>

<p>My simple <strong>.apk</strong> for this question consists of:</p>

<pre><code>public class TestditherActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
}

  @Override
  public void onAttachedToWindow() {
    super.onAttachedToWindow();
    getWindow().setFormat(PixelFormat.RGBA_8888);
  }
}

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center" &gt;

&lt;ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="fitXY"
    android:src="@drawable/test"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>and <strong>test.xml</strong>:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 

&lt;bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:antialias="true"
android:dither="true" /&gt;
</code></pre>

<p><strong>splash.png</strong></p>

<p><img src="http://i.stack.imgur.com/Or5lX.png" alt="source"></p>

<p><strong>result</strong></p>

<p><img src="http://i.stack.imgur.com/N6h85.png" alt="enter image description here"></p>

<p>How to apply <strong>RGBA_8888</strong> and <strong>dither</strong> correctly? Where is my mistake?</p>

<p>The next code gives me perfect result in emulator, but not on the real device:</p>

<pre><code>public class TestditherActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    getWindow().setFormat(PixelFormat.RGBA_8888);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inPreferredConfig = Bitmap.Config.ARGB_8888;
    Bitmap gradient = BitmapFactory.decodeResource(getResources(), R.drawable.splash, options);

    findViewById(R.id.linear).setBackgroundDrawable(new BitmapDrawable(gradient));
}
}
</code></pre>

<p><strong>main.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/&gt;
</code></pre>
