Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 656
Ragunath Jawahar Avatar asked Mar 03 '11 06:03

Ragunath Jawahar


2 Answers


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 :)
like image 199
abikov Avatar answered Nov 23 '22 13:11

abikov


I can confirm adding a dummy image which displays first alphabetically is a fix.

I had an image (titled about.png so of course near the top of the drawable folder) which was not displaying when the test device used was mdpi.

In my case, though, the image was not the first in the directory. I actually had an image which alphabetically displayed first called about_icon.png - which oddly was displaying fine. Additionally, the hdpi version of the image was displaying fine within an hdpi device.

I added a dummy placeholder image called "aaaa.png" and now the mdpi about image displays fine in device.

Very strange, and honestly a pretty lousy bug.

like image 39
Pete Lada Avatar answered Nov 23 '22 13:11

Pete Lada