0

I'm working with android and trying to use an image button. Everything works fine, the only problem is that when I display the image on the emulator, the buttons background color is different then the background of the app. I'm on my mac and I'm using Paintbrush to create the image, and the Digital Colorometer to check the RGB values. Everything checks out, the images have the same background RGB as the image, but one run on an emulator, it lowers them from (84,20,109) to (62,0,86). The colorimeter also says "(clipped)" next to the green value. I'm not sure why this is happening and it certainly is annoying as the buttons clearly stand out now. Is this because of the emulator or is something else happening?

Thanks for any help

Also: I have tried both, using setImageResource, and using android:src. Both have the same result shown above.

TheBrownCoder
  • 1,186
  • 1
  • 10
  • 18
  • Try to set the colour depth of the emulator to 32 bit. http://polyetilen.lt/en/android-virtual-device-screen-bit-depth Also before Gingerbread the colour was always 16 bit, but I don't think you should worry too much about the pre-Gingerbread devices. – Daniel Alexandrov Jul 01 '14 at 22:51
  • I'll check it out, but even the background color of the app is normal, which is set by a # color value. I'll see – TheBrownCoder Jul 01 '14 at 23:11
  • @DanielAlexandrov I tested it on an actual device and the same result happened. It lowers the RGB value by about 20 on each color. I tried setting the backgrounds to 20 higher than the original and the phone indeed reduced it to what I wanted it to be. I tested this on a Galaxy S3 so I can only assume it is something about image button, any ideas? – TheBrownCoder Jul 02 '14 at 21:26
  • I tried the same setup (Paintbrush on MacBook, same colour (84,20,109)/#54146D) and it looks fine both in the emulator and on my LG P880. I don't think it is Do you think you can upload your image somewhere, so I can take a look? – Daniel Alexandrov Jul 02 '14 at 23:11
  • @DanielAlexandrov Well, while I was going through to my xml code that was setting the color to tell you exactly what it is setting to, I learned that it is setting to (106,41,134). It was just that for some reason. my emulator was showing me the colors 20 values darker. Thanks for the guidance. – TheBrownCoder Jul 04 '14 at 02:40
  • Glad you solved it. On a side note, when I use images I almost always use alpha transparent PNG's so I don't need to re-export everything if at some point someone decides that the background should be a bit darker or different tint of blue :) It happened too often in the past – Daniel Alexandrov Jul 04 '14 at 07:16
  • @DanielAlexandrov I'll keep that in mind! I didn't think of that in this case. – TheBrownCoder Jul 04 '14 at 18:58

1 Answers1

0

I figured out what was wrong. It turns out that my emulator was lowering the color values by 20. I resolved it by setting the background color to exactly what it is in the app.

TheBrownCoder
  • 1,186
  • 1
  • 10
  • 18