0

I am making an Android app and have created some imagebuttons for navigation. However, when I assign images to the buttons, the height of the button is never fully filled by the images as can be seen here (the underlying button sticking out has been circled - more obvious in the large bottom button)

For my layout Ive used a Relative layout for the main view and a Linear layout (Vertical) to stack the buttons.

Apart from creating the buttons in xml and adding images to them, I have done no other coding on the buttons yet.

Been trying to figure out all the drawables first but its as confusing as a bag of cats.

Can anyone tell me why this is and how I can possibly fix it?

A--C
  • 36,351
  • 10
  • 106
  • 92
heyred
  • 2,031
  • 8
  • 44
  • 89
  • Try android:adjustViewBounds="true" – MattMatt Aug 21 '13 at 22:56
  • `ImageButton` is meant to display an image *on* a button. If you don't want the button part, don't use an Image*Button*. In stead, use i.e. a plain `ImageView`. – MH. Aug 21 '13 at 23:21
  • If the image is supposed to be displayed on the button, should the image not then cover that whole button and not just part of it? Thought that was the whole point of an image button – heyred Aug 23 '13 at 20:06

1 Answers1

1

To me it just looks like you used

android:src="@drawable/image"

instead of

android:background="@drawable/image"

(That is assuming you are doing this through XML)

Edward van Raak
  • 4,841
  • 3
  • 24
  • 38
  • Yip that seems to have been the issue. The button was set to src rather than background. Ill know for sure tonight if this has worked when I get home and can test on my Android dev phone. It looks OK on XML view but so did the last time. Thanks. Will mark as accepted after test tonight – heyred Aug 22 '13 at 08:41