EmojiTextView renders Emoji semi-transparent

↘锁芯ラ 提交于 2020-02-23 09:13:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!