2012-07-06 43 views
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" 
     /> 

回答

1

我想这是因为您正在使用的ImageButton和灰色你看是该按钮的默认背景。改用ImageView。

+0

我必须使用ImageButton,因为我希望用户点击它来选择下一步。我用android:background =“@ android:color/transparent”制作了透明的按钮,灰色消失了。谢谢 – Tori 2012-07-06 23:15:56

+0

好吧,我不知道这一点,我从来没有使用ImageButton ...所有视图都是可点击的,您甚至可以将点击监听添加到TextView中,还可以显示按下/选中/等状态的背景可绘制。 – Ixx 2012-07-06 23:23:33