I am trying to get the android to smooth out the background image of activity - so far without success. I do not know what happened.
This is what I did:
The root element of my activity layout is LinearLayout:
<LinearLayout android:id="@+id/AbsoluteLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:gravity="center_horizontal" android:background="@drawable/background_dither">
where I added @ drawable / background_dither as the background image. I put the XML file "background_dither.xml" in drawable-hdpi with the following contents:
<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/backimg" android:src="@drawable/background" android:dither="true" android:antialias="true" />
which refers to the actual background.png image in drawable-hdpi. An image that includes a large color gradient does appear, but with intense color gamut. From what I learned from the SDK, this can be mitigated by using the definition of the proxy file view / above along with android: dither = "true". This, however, has no effect.
What am I missing to work anti-aliasing?
EDIT : Uploaded sources
EDIT2 : After none of the suggested methods helped get rid of the color scheme by reading this blog post from Romain Guy , I had the idea to check if my background has a PNG alpha channel. This is not true. After adding one, the android apparently uses RGB8888, as stated in the message, and the bandwidth (also for 2.2). Still wondering why other methods didn't work.
EDIT3 : you need to make sure that PNG has not only an alpha channel, but also at least one pixel with an alpha value! = FF, otherwise the android build tools will again split this bitmap into an indexed palette without an alpha channel.
android android-layout
machtnix Jan 22 '11 at 18:58 2011-01-22 18:58
source share