Card Suit Icons in Android

I notice that when I use unicode characters for card suits (♠ ♣ ♥ ♦) in text views about newer android versions (jelly bean and above), they are displayed not as text but as emoji. It would be nice if I couldn't change their colors. I wish the heart and diamond were red, but they all seem to be locked up like black. I tried Textview.setTextColor (), SpannableStrings and set the font to a different font ... all to no avail. Any ideas on how to resolve this issue?


source to share

1 answer

I faced the same problem. I noticed this problem when I tested the solitaire app on a Galaxy Note 3 running KitKat. Hearts and diamonds were black! And I couldn't change their color in the code. The same builder that works on my Nexus 5 works KitKat as expected. I was able to color the heart and diamond suits in red and the font was flat and not emoji.

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

  • Link to my own font that I know I can color successfully.
  • Create a variety of images required for suit images of varying density.

I decided to go with 2 by merging my own images. It was painful to create 20 images, but I decided it was conceptually cleaner to use images instead of font.



All Articles