我已经看到,因为LollipopAndroid已经Emoji为不同的国家建立了标志.是否可以使用设备区域设置来检索该Emoji国家/地区的标志?
我想将Emoji标志插入TextView包含用户位置的标志.
这个答案有一些代码可以将语言环境转换为 Java 中的国家/地区表情符号。我尝试在 Dart 中实现它,但没有成功。
我尝试将上面的代码转换为 Dart
void _emoji() {
int flagOffset = 0x1F1E6;
int asciiOffset = 0x41;
String country = "US";
int firstChar = country.codeUnitAt(0) - asciiOffset + flagOffset;
int secondChar = country.codeUnitAt(1) - asciiOffset + flagOffset;
String emoji =
String.fromCharCode(firstChar) + String.fromCharCode(secondChar);
print(emoji);
}
Run Code Online (Sandbox Code Playgroud)
“US”区域设置应输出“”
我想将像"US"这样的国家代码转换为Emoji标志,即将"US"字符串转换为Ruby中的相应Unicode.