How to set emoji by unicode in a textview? - Stack Overflow
文章推薦指數: 80 %
How to set emoji by unicode in a textview? android unicode textview encode emoji. Hi I'd like to do the following: ??? unicode = U+ ...
Home
Public
Questions
Tags
Users
Collectives
ExploreCollectives
FindaJob
Jobs
Companies
Teams
StackOverflowforTeams
–Collaborateandshareknowledgewithaprivategroup.
CreateafreeTeam
WhatisTeams?
Teams
CreatefreeTeam
CollectivesonStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
Howtosetemojibyunicodeinatextview?
AskQuestion
Asked
7yearsago
Active
2monthsago
Viewed
85ktimes
100
44
HiI'dliketodothefollowing:
???unicode=U+1F60A
Stringemoji=getEmojiByUnicode(unicode)
Stringtext="Sohappy"
textview.setText(text+emoji);
togetthisinmytextview:
Sohappy😊
HowcanIimplementgetEmojiByUnicode(unicode)?
Whattypeshouldtheunicodevariablebe?(String,char,int?)
PleasenotethatIdoNOTwanttouseDrawables!
androidunicodetextviewencodeemoji
Share
Improvethisquestion
Follow
editedMay22'19at16:29
ADroid
9591111silverbadges2121bronzebadges
askedNov12'14at18:19
GilbertGiesbertGilbertGiesbert
2,98833goldbadges1212silverbadges1010bronzebadges
0
Addacomment
|
6Answers
6
Active
Oldest
Votes
199
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
Share
Improvethisanswer
Follow
editedDec27'16at8:41
Amos
1,47111goldbadge2020silverbadges3333bronzebadges
answeredNov12'14at18:40
GilbertGiesbertGilbertGiesbert
2,98833goldbadges1212silverbadges1010bronzebadges
7
3
workson5.1buton4.4.4igeta?formyemojistring
– filthy_wizard
Jul4'16at12:55
23
Isitpossibletodothisinstrings.xmlfile?
– Spektakulatius
Sep13'16at12:23
@user1232726,Thiswilldependontheuser'sphoneincludingtheemojibeingused.
– Suragch
Jan17'17at3:41
3
Unfortunatelyitdoesn'tworkwith32bitUnicode,likeU+1F1EFU+1F1F2.Thisvalueisoutsidetheintegerboundaries.
– Chris-Jr
Feb4'18at5:46
1
NOte:ForKotlin>fungetEmoji(unicode:Int):String{returnString(Character.toChars(unicode))}
– BipinBharti
Aug30'18at7:21
|
Show2morecomments
50
YoucandirectlyuseEmojisinstringresourcesbyusingthedecimalcodelikethis:
😊
forexample:
延伸文章資訊
- 1关于android:如何在TextView中通过Unicode设置表情符号?
How to set emoji by unicode in a textview?嗨,我想做以下事情:[cc]??? unicode = U+1F60AString emoji = getEm...
- 2FAQ - Emoji & Pictographs - Unicode
- 3How 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 ...
- 4android - How to set emoji by unicode in a textview? - OStack.cn
??? unicode = U+1F60A String emoji = getEmojiByUnicode(unicode) String text = "So happy " textvie...
- 5Display 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...