我的IM应用程序必须支持表情符号。它们是GIF和有文本重新presentations,它们用于在输入框中如果用户选择其中之一。但我想将其显示为图像,他们已经经过sent.Currently我的自定义阵列适配器显示发送的消息一排的一个TextView。
My IM app has to support emoticons. They are GIFs and have textual representations, which are used in the input box if the user selects one of them. But I'd like to display them as images after they have been sent.Currently my custom array adapter displays the sent message in a TextView of a row.
什么是正确的方法来显示动态的基础上,他们的文字重新presentation发生图像?我一定要寻找表情符号文本,如果一经发现,从布局中删除的TextView(RelativeLayout的适合大多数?),并添加一个TextView与IM,用表情和其他的TextView的ImageView的的开始。如果有更多的表情符号同时发送也可以是凌乱的。
What is the proper method to display images dynamically based on the occurrence of their textual representation? Do I have to search for emoticon texts, and if one found, remove the TextView from the layout (relativeLayout fits most?) and add a TextView with the beginning of the IM, an ImageView with the emoticon and another TextView. If more emoticons sent simultaneously it can be messy.
有没有一种更简单,更合理的方式?
Is there an easier and more logical way?
我会尝试使用普通的EX pression更换每一个表情符号所有出现的一个< IMG>
标记。然后,将其转换成HTML的一个 SpannedString
的() 。这 SpannedString
中可以使用的setText()
致电的TextView
。
I would try using a regular expression to replace all occurrences of each emoticon with an <img>
tag. Then, convert that HTML into a SpannedString
via Html.fromHtml()
. That SpannedString
can be used in a setText()
call on TextView
.
上一篇:Android的:如何自动重新启动应用程序后,它已经与QUOT;强制关闭&QUOT;?重新启动、应用程序、Android、QUOT
下一篇:FFMPEG的机器人(使用教程:&QUOT; ffmpeg的和Android.mk&QUOT;)机器人、教程、FFMPEG、QUOT