我在使用透明PNG在android/eclipse中看起來有些問題。Android(日食)PNG透明度顯示爲黑色(帶圖片示例)
我有這樣的:
<ImageView
android:id="@+id/someid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/theimage" />
的XML圖形佈局中的ImageView使用該圖像時顯示圖像的透明度爲黑色:
http://s7.directupload.net/file/d/3140/ehqd3yhm_png.htm
如果我用下面的圖像的透明度顯示正常:
http://s7.directupload.net/file/d/3140/dc5aco6n_png.htm
您將看到圖像圖標作爲Windows桌面壁紙的透明盈方。您也可以手動驗證圖像,看看它們是否都是透明的。
這是一個錯誤還是發生了什麼?我無法創建將在eclipse/android中顯示的透明PNG。所以我從網上的第二張圖片給你看...
編輯:我需要使很多圖像透明,目前我使用irfanview。還有什麼其他計劃適合?
EDIT2:要注意
一個附加的東西是我把
android:theme="@android:style/Theme.Light"
到我的表現,因爲我想白色的主題,而不是黑色。不知道這是否有任何意義。
整個XML文件如下:
<?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>
Photoshop。或者,如果你沒有那個免費的GIMP。 (http://www.gimp.org) – pumpkee
爲了讓您知道,我嘗試了您提供的第一張圖片,並在我的SGS II上正常工作。 – harism
嗯,它與android:theme =「@ android:style/Theme.Light」有什麼關係,我偶然將它放入我的清單文件中?我能做些什麼來解決這個問題? – cdbeelala89