3

I am noticing that when I use the unicode symbols for card suits (♠♣♥♦) in textviews on newer versions of android (jelly bean and up), they show up not like text but as emoji. That would be fine except I can't seem to change their colors. I would like the heart and diamond to be red but it seems like they are all locked as being black. I have tried Textview.setTextColor(), SpannableStrings and setting the font to a different typeface...all to no avail. Any ideas on how to solve this?

JLK
  • 777
  • 6
  • 14
  • You could try this iOS solution http://stackoverflow.com/questions/8208126/prevent-emoji-characters-from-showing – weston Sep 18 '14 at 08:06

1 Answers1

2

I have run into the exact same issue. I noticed the issue when I tested my solitaire app on a Galaxy Note 3 running KitKat. The hearts and diamonds were black! And I could not change their color in code. The same build running on my Nexus 5 running KitKat ran as I expected. I was able to color the heart and diamond suits red and the font was flat, not emoji.

I think the issue is that TouchWiz replaced the default font with the emoji unicode font. The two possible solutions I came up with were:

  1. Bundle my own font that I know I can color successfully.
  2. Create the multitude of images needed for the suit images at different densities.

I decided to go with 2, bundling my own images. It was a pain to create the 20 images, but I decided it was conceptually cleaner to use images instead of a font.

John Slavick
  • 10,179
  • 5
  • 28
  • 25