表情符号(表情符号)视图/键盘布局的实现 [英] Implementations of Emoji (Emoticon) View/Keyboard Layouts

查看:56
本文介绍了表情符号(表情符号)视图/键盘布局的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚如何在 Facebook 应用程序和 Google Hangouts 应用程序上实现表情符号(表情符号)选择.我查看了 Android API 示例中的 SoftKeyboard 演示应用程序,但这些表情符号视图的显示看起来不像 SoftKeyboard.它的外观和行为更像是一个自定义的 Dialog 视图.有没有人知道这些是如何实现的?

I am trying to figure out how the emoji (emoticon) selections are implemented on the Facebook app and the Google Hangouts app. I looked into the SoftKeyboard Demo app in the Android API Samples but the display of these emoji views does not look like a SoftKeyboard. It looks and behaves more like a custom Dialog view. Does anyone have an idea of how these are implemented?

此外,Unicode 是发送表情符号的最佳方式还是有其他选择?我注意到一些 Unicode 序列如 u1F601 不呈现相应的表情符号,而是该序列仅显示为 1 :

Also, is Unicode the best way to send emoticons or is there an alternative? I noticed that some Unicode sequences like u1F601 don't render the corresponding emoticon and instead that sequence just shows up as 1 :

EditText messageInput = (EditText) findViewById(R.id.message_input);
messageInput.getText().append("u1F601");

推荐答案

我发现了一个非常有用的表情键盘.此键盘不使用 Unicode 序列,而只是使用本地图像资产.我认为这种类型的键盘只能在这个应用程序中有用,而不能用于其他应用程序或操作系统.

I found a very useful Emoticon Keyboard. This keyboard is not using Unicode sequences but rather just local image assets. I am thinking that this type of keyboard can only be useful within this app and not with other apps or Operating Systems.

因此,我将包含资产的 ImageView 替换为包含 Unicode 序列的 TextView.

So instead I am replacing the ImageView containing an asset with a TextView containing a Unicode sequence.

交叉引用支持的Unicode序列以及Visual Unicode Database 我意识到 u1F601 是一个 32 位的 Unicode 表示,而 16 位的表示可以设置为:

After cross referencing Supported Unicode Sequences as well as the Visual Unicode Database I realized that u1F601 was a 32 bit Unicode representation, and the 16bit representation can be set like :

EditText messageInput = (EditText) findViewById(R.id.message_input);
messageInput.getText().append("ud83dude01");

这篇关于表情符号(表情符号)视图/键盘布局的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆