2012-07-17 70 views
0

我在我的Android应用程序中有以下表。除了最后一个按钮,一切都有效 - 关于我。当我将背景设置为透明色时 - 它不是在我的设备上显示的(但是,它在日食中的布局的图形视图中可见)。通过“不显示”我的意思是,它不在屏幕上 - 它的地方它的“下一个”如果我删除的android:。从最后一个按钮的背景 - 它回来到设备的哪些错误 Android - 按钮从布局中消失时,它有透明背景

   <TableRow 
        android:id="@+id/tableRow1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal" > 

        <ImageButton 
         android:id="@+id/buttonShare" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@color/transparent" 
         android:onClick="shareIt" 
         android:src="@drawable/social_share" /> 

        <ImageButton 
         android:id="@+id/buttonBack" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@color/transparent" 
         android:onClick="prevImage" 
         android:src="@drawable/navigation_previous_item" /> 

        <ImageButton 
         android:id="@+id/button1" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@color/transparent" 
         android:src="@drawable/navigation_accept" /> 

        <ImageButton 
         android:id="@+id/buttonAbout" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@color/transparent" 
         android:onClick="showAbout" 
         android:src="@drawable/action_about" /> 

        <ImageButton 
         android:id="@+id/buttonForward" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@color/transparent" 
         android:onClick="nextImage" 
         android:src="@drawable/navigation_next_item" /> 

        <ImageButton 
         android:id="@+id/buttonAbout" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="@color/transparent" 
         android:onClick="showAbout" 
         android:src="@drawable/action_about" /> 
       </TableRow> 
      </TableLayout> 

我的颜色资源的一部分,是象下面这样:

<color name="transparent">#00000000</color> 

我刚刚加载了一个新的动作,现在,按钮出现 - 但它显示了旧的PNG,而不是新的,这是怎么回事?

+0

在包资源管理器中右键单击您的项目并按下“清理项目”有时资源卡在旧版本上,清理它们通常会修复它。 – FoamyGuy 2012-07-17 01:35:30

+0

我看不到Clean Project选项。版本:Indigo Service Release 1 – bluszcz 2012-07-17 01:38:11

+0

嗯,也许将它从上下文菜单中删除。如果您在包资源管理器中选择了项目,然后点击顶部的“项目”,那么您是否有'clean ...'选项? – FoamyGuy 2012-07-17 01:52:22

回答

1

你为什么要设置背景为透明?你只是想要一个没有设备默认按钮“框架”,而只有你的action_about可绘制的按钮?如果是这样,你可以做到这一点与正常的按钮,而不是ImageButton的,像这样:

<Button 
    android:id="@+id/buttonAbout" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/action_about" 
    android:onClick="showAbout"/> 

编辑:另外请注意,您在您的布局有buttonAbout元素的两倍,它是在底部,和3从底部。

编辑2:在顶部的Project菜单下,您是否还没有clean...选项?或者只是变灰了?

我下载的是Eclipse靛蓝SR2(我找不到SR1网站上的链接),它是对我有。 enter image description here

+0

是的,我固定twiced buttonAbout - 这只是实验来检查按钮是否会显示在不同的位置。 – bluszcz 2012-07-17 01:16:40

+0

老实说 - 我昨天失去了项目的控制权(没有更新资源让我感到头痛,并且我在凌晨4点觉得睡着了)。早上我发现你提到的选项,现在看起来很有效。似乎 - 我不确定。但我很感谢你的帮助。 – bluszcz 2012-07-17 14:27:56

+0

没问题,很高兴它似乎工作! – FoamyGuy 2012-07-17 16:59:12