如何使用表情符号库在文本中添加表情符号?

use*_*140 2 android textview

我想在预定义的文本视图中添加表情符号。用户无需更改。我怎样才能做到这一点

“你好呀 !”

在文本视图中

在 Android 中使用表情符号库?我需要使用表情符号库吗?

Nav*_*hna 5

您不需要为此使用库。

Method 1

假设你有一个 textview,然后试试这个

textView.setText(new String(Character.toChars(0x1F60A)));
Run Code Online (Sandbox Code Playgroud)

0x1F60A你笑脸的 unicode在哪里

Alternate Method

添加此资源 strings.xml

<string name="smiley_text">&#x1F60A;</string>

然后将其添加到 textview 如下所示

textview.setText(R.string.smiley_text);
Run Code Online (Sandbox Code Playgroud)