How to set emoji by unicode in a textview? - py4u
文章推薦指數: 80 %
??? unicode = U+1F60A String emoji = getEmojiByUnicode(unicode) String text = "So ...
Howtosetemojibyunicodeinatextview?
HiI'dliketodothefollowing:
???unicode=U+1F60A
Stringemoji=getEmojiByUnicode(unicode)
Stringtext="Sohappy"
textview.setText(text+emoji);
togetthisinmytextview:
Sohappy?
HowcanIimplementgetEmojiByUnicode(unicode)?
Whattypeshouldtheunicodevariablebe?(String,char,int?)
PleasenotethatIdoNOTwanttouseDrawables!
AskedBy:GilbertGiesbert||Source
Answer#1:
Foundasolution:
InmyunicodeIreplaced'U+'by'0x'
Example:replace'U+1F60A'by'0x1F60A'
ThiswayIgotan'int'like
intunicode=0x1F60A;
Whichcanbeusedwith
publicStringgetEmojiByUnicode(intunicode){
returnnewString(Character.toChars(unicode));
}
SoTextviewdisplays?withoutDrawable
Tryitwithhttp://apps.timwhitlock.info/emoji/tables/unicode
AnsweredBy:GilbertGiesbert
Answer#2:
YoucandirectlyuseEmojisinstringresourcesbyusingthedecimalcodelikethis:
😊
forexample:
延伸文章資訊
- 1android - How to set emoji by unicode in a textview? - OStack.cn
??? unicode = U+1F60A String emoji = getEmojiByUnicode(unicode) String text = "So happy " textvie...
- 2android - 如何在TextView 中通过unicode 设置表情符号?
嗨,我想执行以下操作: ??? unicode = U+1F60A String emoji = getEmojiByUnicode(unicode) String text = "So hap...
- 3How to access and use emoji on Android
- 4how set emoji by unicode in a textview? - SemicolonWorld
??? unicode = U+1F60A String emoji ...
- 5FAQ - Emoji & Pictographs - Unicode