Android rendering shade of blue wrong on some devices-ThrowExceptions

Exception or error:

I’m running an app on various devices and on two a certain shade of blue looks wrong. Please see the attached image. Any ideas why that is?
If I replace the color with a different one without any other changes, everything looks fine.
enter image description here

EDITOR’s NOTE: Original poster states that there is a single colors.xml file in the project’s resources and the color is defined once. The color is defined by a name (@color/pbr) and has a value of #447AD4. The layout for the screenshots above uses the same resource name throughout, but renders as different colors.

How to solve:

So this looks like an issue with tintMode. The reason the colors look different is the transparency. By default, Drawables in Android have a tintMode of SRC_IN, meaning they will keep their color but use the alpha of whatever is underneath them during rendering. From the looks of it, there are views underneath the blue ones that are not 100% opaque.

To solve this you could explicitly set the tintMode to something like SRC_OVER which will keep the alpha you set intact. The other option is instead of setting at the background to a color, set it to a Shape Drawable with a solid fill. That will make sure that the view is opaque and will have a consistent color.

###

Using paint.net I could verify that the text color “Search for your food” is the same on every device which rules out a device-global shade or an error in the screenshot retrieval process

  • For anyone wanting to verify this: take care that you check a color in the middle of a letter, e.g. the center of the f cross so you don’t get anti-aliasing colors.
  • UPDATE: this indicates that the differing area colors are not a device-global color handling issue since at least the text color is the same

Make sure that you both did not specify

  1. Different layout files
  2. Different color drawables

for different Android versions/ screen densities / screen sizes

###

Have you checked that the resource that you’re referencing (the color) is not provided multiple times for different screen resolutions using configuration qualifiers?

For example, make sure you don’t have multiple colors.xml or styles.xml in a values-mdpi folder or values-xxhdpi folder. If it is referenced in more than one folder, that’s your issue.

http://developer.android.com/guide/practices/screens_support.html#qualifiers

###

You might have customized the theme in

res/values/style.xml

Also customize similarly in

res/values-v11/style.xml and res/values-v14/style.xml

(Create the values-v11 and values-v14 folders if not already there and copy paste your style.xml into them. If the folders and style.xml inside them is already them, append your stuff and make sure you do not remove anything important by overwriting the file.)

Source

###

It may be a device specific issue with the color #447AD4. Different smartphone manufacturers use different type of screen in their device. So it is possibly a device specific issue i think.

###


REASON


There is no “silver-bullet” reason for that but one of the possible reason could be drivers. Certain chipset manufacturers have done an especially bad job at updating their graphics drivers, which makes the colors in apps, games and any graphic content inconsistent across phones. Developers might encounter entirely different color schemes on various Android devices, none close to what they intended.

Samsung screens use differently shaped pixels.

This issue may be due to PenTile screen and the main difference is that the red, green, and blue subpixels aren’t the same as a normal display.

Basically, instead of each pixel getting a red, green, and blue subpixel that are the same size, a PenTile pixel gets red and green or blue and green subpixels. The red and blue are larger than the green to balance the brightness.
Because there are twice as many green subpixels than red and blue on your phone, your color choice is probably out of gamut on these devices.


SOLUTION


All devices pick colors at different intensities. You cannot do much about it. Its hardware that renders the images and colors in it. If you want consistency among all devices you have to calibrate your monitor.

Leave a Reply

Your email address will not be published. Required fields are marked *