Search code examples
androidlayoutdrawableimagebutton

ImageButton does not display a particular drawable


This is rather a funny problem I have ever come across,

I have a table layout with 9 image buttons, 3 per row. Every ImageButton has a different image associated with it. I have set the background of the image button to transparent (#00000000). Now here is where the funny stuff happens, One of the images doesn't show up on the emulator (Gingerbread) as well as a device running Froyo. The layout editor shows all the images in place.

Here are some more stuff:

  1. I used a RelativeLayout instead of a TableLayout, the same issue persists.
  2. I changed the position of the image (used it on different buttons) and still it doesn't show up.
  3. When I use a different image they show up, but when I use this particular image it won't.
  4. All images have the same resolution (90x72) and density (72ppi)
  5. All the images are in the the drawable-mdpi folder.

Any pointers?

EDIT Turned out to be a bug and this issue has been resolved. Please check this link.


Solution


  • Do you still have the problem. I had a similar bug - a particular drawable was not being displayed, no matter in what `ImageView`.
    Is it the case that your image is the first (alphabetically) in the drawable folder? For some strange reason there is a problem with the first drawable, I've solved my problem by adding a dummy drawable in first place. Still I'm very curious where the actual problem is.

    Hope that helps! And I'm looking forward for any further explanations :)