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:
延伸文章資訊
- 1关于android:如何在TextView中通过Unicode设置表情符号?
How to set emoji by unicode in a textview?嗨,我想做以下事情:[cc]??? unicode = U+1F60AString emoji = getEm...
- 2How to set emoji by unicode in a textview? - Stack Overflow
How to set emoji by unicode in a textview? android unicode textview encode emoji. Hi I'd like to ...
- 3How to Input Unicode - Xah Lee
- 4Display emoji/emotion icon in Android TextView | Newbedev
Why do you want to embed the protected Apple emoji images in your application at all? The Unicode...
- 5TextDrawable to display emojis and Unicode characters in ...
TextDrawable to display emojis and Unicode characters in Android ... Aligning the text to the tex...