问题
I'm implementing the new EmojiCompat into my app. Now I run into the following issue and don't know how to fix it:
The code below is rendered by the EmojiCompat, but the Emoji is rendered semi-transparent:
<android.support.text.emoji.widget.EmojiTextView
android:textAlignment="center"
android:text="😍"
android:textSize="100dp"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Screenshot of the rendered XML file on my device:
The layout inspection says: alpha: 1.0
How can I fix the TextView to render it fully non-transparent?
Emoji compat version: com.android.support:support-emoji:27.1.+
回答1:
Because the default text color of my Theme was not pure black this is the fix:
mEmojiTextView.setTextColor(0xff000000); // set view textcolor to black
回答2:
It's the default text color for material theme which is grey not pure black. Just set your EmojiTextView text color to black.
android:textColor="#FF000000"
<android.support.text.emoji.widget.EmojiTextView
android:textAlignment="center"
android:text="😍"
android:textSize="100dp"
android:textColor="#FF000000"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
来源:https://stackoverflow.com/questions/50840047/emojitextview-renders-emoji-semi-transparent