显示用于输入法的内置表情符号键 [英] display built-in emoji keys for inputmethod

查看:152
本文介绍了显示用于输入法的内置表情符号键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为android构建自定义软键盘,并想添加一个布局以包含表情符号键,类似于默认的android键盘(AOSP)所做的事情.我到处搜寻,但似乎大多数人都试图从图像中显示自定义表情符号.我希望显示Android随附的内置图标(如下所示):

I'm building a custom soft keyboard for android and would like to add a layout to include the emoji keys similar to what the default android keyboard (AOSP) is doing. I've searched around but it seems that most people are trying to display custom emoji from images. I'm looking to show the built-in icons that comes with Android (as shown below):

似乎我应该能够使用Unicode字符从键盘发送图像,但是我的第一次尝试似乎只是生成较旧版本的表情符号.我如何支持手机可以处理的最新表情符号?另外,如何如上图所示在键盘上显示表情符号?

It seems that I should be able to use the Unicode characters to send images from the keyboard, but my first attempt seems to generate only the older versions of the emojis. How do I support the latest emoji the phone can handle? Also, how do I display the emojis in my keyboard as in the image above?

推荐答案

感谢所有建议.在自定义键盘上显示表情符号布局的工作如下:

Thanks for all the suggestions. What I got to work for showing an emoji layout in my custom keyboard was the following:

  1. 在.xml布局文件中,为您要添加的每个表情符号创建一行,如下所示:<Key android:codes="0x1F602" android:keyLabel="\ud83d\ude02"/>

提交密钥时,使用:getCurrentInputConnection().commitText(String.valueOf(Character.toChars(primaryCode)), 1);

这篇关于显示用于输入法的内置表情符号键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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