I'm trying to display a single Unicode character (an emoji) in a TextView, with a large(r) text size:

mEmojiTextView = (TextView) findViewById(R.id.emoji_text_view);
mEmojiTextView.setTextSize(200);
mEmojiTextView.setText("\uD83D\uDE01");

The character does not appear on the screen, and I get this error in logcat:

E/OpenGLRenderer﹕ Font size too large to fit in cache. width, height = 545, 513

The largest size that works is

mEmojiTextView.setTextSize(150);

and the Emoji character appears. It's not like it's full screen or anything, at this text size there is enough space on the screen for about 6 emoji characters.

I'm running the test on a LG Nexus 5 phone, with 1080 x 1920 resolution, running Android 5.1.1. I'm using minSdkVersion 11 and targetSdkVersion 23

I tried many workarounds found on StackOverflow and elsewhere:

mEmojiTextView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

<TextView android:layerType="software" ... />

<activity android:hardwareAccelerated="false" ... />

Nothing works.

Is there a way I can get it to work?

1

There are 1 answers

1
Wackaloon On BEST ANSWER

It's an android issue Issue with emoji with 200sp size No way to fix it at the moment, just don't set size more than 199 if you have emoji in TextView