Android - Button disappear from the layout when it has transparent background

I have following Table in my Android app. Everything works, except the last button - about me. When I set background to transparent color - it is not beign display on my device (however, it is visible on the graphical view of the layout in the eclipse. By "not display" I mean, that it is not on the screen - on its place its "next". If I remove android:background from the last button - it comes back to device. Whats wrong?

                <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>

Part of my color resource is like below:

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

I just loaded overwrited action_about.png picture with new one. Now, the button appears - but it shows old png, about, not the new one. What is going on?

Answers


Why are you trying to set the background to transparent? Do you just want a button that does not have the device default button "frame" and instead has only your action_about drawable? If so you can do that with a normal Button instead of ImageButton like so:

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

EDIT: Also note that you have the buttonAbout element twice in your layout, it is at the bottom, and 3 from the bottom.

EDIT 2: Do you not have a clean... option at all under the Project menu at the top? or is it just grayed out?

I downloaded Eclipse Indigo sr2 (I can't find link on the site for sr1) and It is there for me.


Need Your Help

In AngularJs When i call function not able to get $scope

javascript jquery angularjs scope

In angularjs when i click on button,then it will call function of Controller but in that function i am not able to get $scope or $rootScope.

Syntax error (missing operator) in query expression VBA

excel vba excel-vba

I'm getting an error message when I want to run my query (syntax error (missing operator) in query expression). I don't know where the issue can be.