在Android上获取表情符号iOS

问题描述 投票:0回答:1

有没有办法使用com.android.support:support-emoji:28.0.0在Android上的TextView上获取表情符号iOS

我想避免那个开源库...请帮忙吗?谢谢

android android-appcompat emoji
1个回答
0
投票

你可以使用unicode表情符号。

这是链接:https://unicode.org/emoji/charts/full-emoji-list.html

要在Android中使用它,您需要将U +替换为0x,因此它将是一个整数。

要将unicode设置为TextView中的文本,您可以使用;

Java的:

public String createEmoji(int unicode){
    return new String(Character.toChars(unicode));
}

科特林:

fun createEmoji(unicode: Int): String {
    return    String(Character.toChars(unicode)) 
}
© www.soinside.com 2019 - 2024. All rights reserved.