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.
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.
red(int) to extract the red component. green(int) to extract the green component. blue(int) to extract the blue component.
A selector may be created by invoking the open method of this class, which will use the system's default selector provider to create a new selector. A selector may also be created by invoking the openSelector method of a custom selector provider. A selector remains open until it is closed via its close method.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With