I have problems making transparent PNGs look transparent in android/eclipse.
I have this:
<ImageView
android:id="@+id/someid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/theimage" />
The XML graphical layout show the image transparency as BLACK when using this image in the imageview:
http://s7.directupload.net/file/d/3140/ehqd3yhm_png.htm
If I use the following image the transparency is shown fine:
http://s7.directupload.net/file/d/3140/dc5aco6n_png.htm
You will see image icons as transparent infront of a windows desktop wallpaper. You may also verify the images by hand to see that they infact both are transparent.
Is this a bug or what is going on? I am not able to create a transparent PNG that will show in eclipse/android. So I took the second image from the web to show you…
EDIT: I need to make lots of images transparent, currenty I am using irfanview. What other program would suit?
EDIT2:
One additional thing to note is I put
android:theme="@android:style/Theme.Light"
into my manifest because I want white theme instead of black. Don’t know if that has any implications.
The whole XML file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/beleg_imagegesperrt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_schloss_zu"/>
<!-- this is the imageview I test with, i added android:background="#FF0000" but does not help -->
<ImageView
android:id="@+id/beleg_imageabgeschlossen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClickBarauslagen"
android:src="@drawable/dddd"
/>
<ImageView
android:id="@+id/beleg_imageeinsatzberichtvorhanden"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_notizbuch_unselected" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/beleg_textbelegid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textbelegid" />
<TextView
android:id="@+id/beleg_belegid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/abstand_liste"
android:text="@string/belegid" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/beleg_textbelegvonbis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textbelegvonbis" />
<TextView
android:id="@+id/beleg_belegvon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/abstand_liste"
android:text="@string/belegvon" />
<TextView
android:id="@+id/beleg_belegbis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/abstand_liste"
android:text="@string/belegbis" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/beleg_textbelegabgeschlossen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textbelegabgeschlossen" />
<TextView
android:id="@+id/beleg_belegabgeschlossen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/abstand_liste"
android:text="@string/belegabgeschlossen" />
<TextView
android:id="@+id/beleg_textbeleggesperrt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textbeleggesperrt" />
<TextView
android:id="@+id/beleg_beleggesperrt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/abstand_liste"
android:text="@string/beleggesperrt" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/beleg_textbelegsummestunden"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textbelegsummestunden" />
<TextView
android:id="@+id/beleg_belegsummestunden"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/abstand_liste"
android:text="@string/belegsummestunden" />
</LinearLayout>
</LinearLayout>
OK
Cofirmed it is a IrfanView bug.
If I use the IrfanView plugin pngout.dll (thank god this exists) to save the png however (you can select in the save dialog whether to use the plugin), the pngs are not “corrupted”.
Who would have thought?
edit: downbload the plugin here http://www.irfanview.com/plugins.htm (in one of those zip files)
edit2: ok could also be a bug of eclipse. whatever program writes or reads the PNG non-standardconform, that is