I'm facing a weird issue where I'm setting the background of a TextView to @android:color/holo_blue_bright
, expecting it to be bright blue, only to find that it's some kind of bright green on a device.
XML
<TextView
android:id="@+id/tv_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/chat_bubble"
android:maxWidth="300dp"
android:padding="5dp"
android:singleLine="false"
android:textSize="16sp" />
@drawable/chat_bubble
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/chat_bubble_background" />
<corners android:radius="5dp" />
</shape>
colors.xml (just the relevant line)
<color name="chat_bubble_background">@android:color/holo_blue_bright</color>
Above settings produce this. Each message is a TextView
I thought maybe it was because my device displays colors differently or something, so I tried some more holo colors, but they all look exactly as they should
@android:color/holo_green_light gives
@android:color/holo_green_dark gives
Even @android:color/holo_orange_light and @android:color/holo_purple look OK
except for the blue ones:
@android:color/holo_blue_light gives
@android:color/holo_blue_dark gives
All blue appear as similar, but not exactly the same tints of green. Also not the same tint of green as holo_green_light
or holo_green_dark
.
I thought what is this? Everything looks good, but not blue? and went to check what the HEX of holo_blue_bright
is and I found it here (it's #FF00DDFF
).
So I tried to use that HEX values directly, instead of using the predefined holo color.
Android studio (v1.2) tells me they are exactly the same color, as I expected.
However, when I then changed
<solid android:color="@color/chat_bubble_background" />
to
<solid android:color="@color/chat_bubble_background2" />
to use #FF00DDFF
as color, I got this
Which is exactly what I expected to see when I was using holo_blue_bright
! Which should makes sense, considering they're the same color.
I'm stumped. What is going on here, what am I missing? Why do 2 supposedly equal color codes produce different results, and why are all the other holo colors looking normal?
Device info:
OnePlus One
Model A0001
Running Cyanogen OS v11.0-XNPH05Q / kernel 3.4.0-cyanogenmod-gc73a4ec build 04
Running Android 4.4.4