0
在Android中,我將兩個圖像製作成一個較小的動畫。小圖片使用Photoshop生成,可見部分被棋盤圖案包圍(應該是透明的)。當動畫運行時,圖像出現,但棋盤圖案顯示爲灰色方塊。我該如何讓圖像的透明部分不會出現
我怎樣才能使它透明。
這是ImageButton的是如何設置的layout.xml
<ImageButton
android:layout_gravity="top|left"
android:layout_marginLeft="184dp"
android:layout_marginTop="55dp"
android:id="@+id/videothumb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/button_power_on" />
而且動畫文件:
<?xml version="1.0" encoding="utf-8"?>
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0"
android:toAlpha="0.8"
android:duration="5000"
android:repeatMode="reverse"
android:repeatCount="infinite"
/>
我必須使用ImageButton,因爲我希望用戶點擊它來選擇下一步。我用android:background =「@ android:color/transparent」製作了透明的按鈕,灰色消失了。謝謝 – Tori 2012-07-06 23:15:56
好吧,我不知道這一點,我從來沒有使用ImageButton ...所有視圖都是可點擊的,您甚至可以將點擊監聽添加到TextView中,還可以顯示按下/選中/等狀態的背景可繪製。 – Ixx 2012-07-06 23:23:33