如何在TextView Android上使用带有文本的图像(设备的存储图像)? [英] How to use the Image(Stored Image of device) with Text on TextView Android?

查看:131
本文介绍了如何在TextView Android上使用带有文本的图像(设备的存储图像)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建聊天应用,我从服务器(IMAGE URLS)获取 EMOJI

I am creating the chat app , in which i am getting the EMOJI from the server (IMAGE URLS).

我正在使用此图像(表情符号网址),在我的 TextView 中使用以下代码行中的文字。

I am using this images(Emoji url) with text in my TextView by below lines of the code.

String stringWithHtml = "Sample string with an <img src=\"http://MY_SERVER.emoji.s3.amazonaws.com/cf68/5794d5f7895fa10a8f8e1350/imgList/5794d5f7895fa10a8f8e136a.png\"></img>" +
                        "<img src=\"http://MY_SERVER.emoji.s3.amazonaws.com/cf68/5794d5f7895fa10a8f8e1350/imgList/5794d5f7895fa10a8f8e135a.png\"></img>"+
                        "<img src=\"http://MY_SERVER.emoji.s3.amazonaws.com/cf68/5794d5f7895fa10a8f8e1350/imgList/5794d5f7895fa10a8f8e135b.png\"></img>"; 


Drawable drawable = Drawable.createFromStream(new URL(source).openStream(), "src name");
                    drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());

Spanned spannedValue = Html.fromHtml(stringWithHtml, drawable, null); 
MY_TEXTVIEW.setText(spannedValue);

这一切都在我用 AsynTask 并获得如下预期结果: -

This all stuff , i am using in the AsynTask and getting the expected result like below:-

现在我将所有表情符号(图像)存储在我的设备上,并希望在我的 TextView 中使用它。

Now i am storing all the emojis(Images) on my device and want to use it with text in my TextView.


我的问题是我们如何在TextView上使用带有文本的设备(存储图像)?

我在SO上搜索过但没有得到预期的结果。请查看我访问过的以下链接。

I have searched about it on SO but did not get the expected result.Please check below link which i have visited.

1。第一个链接

2。第二个链接

3。第三个链接

4。 Forth Link

我已经使用了 ImageSpan 但是出现了另一个问题,我已经在 SO 点击这里

I have used the ImageSpanfor it but the other problem arises , which i have posted the question on SO Click here

这篇关于如何在TextView Android上使用带有文本的图像(设备的存储图像)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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