【问题标题】:Emoji Icon is showing Strange Letters in TextView表情符号图标在 TextView 中显示奇怪的字母
【发布时间】:2023-03-11 23:55:01
【问题描述】:

我知道有些人已经问过这个问题,但我仍然在过去 1 天遇到问题。我有聊天应用程序,我的表情符号已成功发送并在网站中完美显示,但在 TextView 中返回奇怪字符。我正在使用这个Library for Emoji in TextView

这是来自网络的响应

data

: "{"type":"text","message":"\ud83d\ude29","to":"264","from":"175","group_id":"0","groupFlag":0 }"

但我的 TextView 显示此值

ðÿ˜ðÿ˜¡ðÿ˜¡ðÿ˜¡

**我的截图在这里**

请指导我如何在 TextView 中显示 Emoji。 ?我的完整代码是

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    rootView = findViewById(R.id.root_view);
    emojiButton = (ImageView) findViewById(R.id.emoji_btn);
    submitButton = (ImageView) findViewById(R.id.submit_btn);
    emojiconEditText = (EmojiconEditText) findViewById(R.id.emojicon_edit_text);
    textView = (EmojiconTextView) findViewById(R.id.textView);
    emojIcon = new EmojIconActions(this, rootView, emojiconEditText, emojiButton);
    emojIcon.ShowEmojIcon();
    emojIcon.setKeyboardListener(new EmojIconActions.KeyboardListener() {
        @Override
        public void onKeyboardOpen() {
            Log.e("Keyboard", "open");
        }

        @Override
        public void onKeyboardClose() {
            Log.e("Keyboard", "close");
        }
    });



    submitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String newText = emojiconEditText.getText().toString();
            textView.setText(newText);
        }
    });
}

【问题讨论】:

  • 禁用系统默认表情符号。它只会使用应用表情符号而不是系统
  • 嗨 @androidXP 对不起,运气不好.. 除了特殊字符集外,它仍然没有显示表情符号

标签: android emoji


【解决方案1】:

你可以试试这个可能有效: emojIcon.setUseSystemEmoji(true);

【讨论】:

  • 感谢您的回复。但仍然显示奇怪的字符集
【解决方案2】:

也许您需要将 Html 请求转换为字符串

Html.fromHtml((String) YOUR_STRING_HERE).toString()

【讨论】:

  • 您好先生试过了.. 但没有运气.. 当 SDample 为这个库做得很好时,即使我也无法找出为什么这个显示问题
  • 也许你做的不对。如果您完全卡住了,请将其作为问题发布到 sDample github 库中
猜你喜欢
  • 2012-04-02
  • 2014-10-17
  • 2011-12-23
  • 2021-05-25
  • 2016-04-05
  • 2014-11-14
  • 1970-01-01
  • 1970-01-01
  • 2016-04-06
相关资源
最近更新 更多