将图像放入哈希图中?
谁能帮助我如何将图像放入哈希图中?
我尝试了这样的事情:
HashMap<String, Object> map = new HashMap<String, Object>();
String img_1 = "<img src='http://graph.facebook.com/" + friends.get(i).getId()
+ "/picture?type=small' />";
map.put("item", Html.fromHtml(img_1));
map.put("friend", friends.get(i).getName());
System.out.println("Valoare HashMap este:" + map);
mylist.add(map);
但我只看到文本,没有图像。
请帮忙....
Can anyone help me how to put images in a hashmap?
I tried something like this :
HashMap<String, Object> map = new HashMap<String, Object>();
String img_1 = "<img src='http://graph.facebook.com/" + friends.get(i).getId()
+ "/picture?type=small' />";
map.put("item", Html.fromHtml(img_1));
map.put("friend", friends.get(i).getName());
System.out.println("Valoare HashMap este:" + map);
mylist.add(map);
but I see only the text, without image.
Please help....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里:
http://developer.android.com/reference/android/text/Html。 html
在 public static Spanned fromHtml 的描述中(字符串源)
它说:
“从提供的 HTML 字符串返回可显示样式的文本。HTML 中的任何标记都将显示为通用替换图像,然后您的程序可以遍历该图像并将其替换为真实图像。”
因此,您将从该方法中获得应该获得的内容,如果您需要获取整个图像,请查看: Android HTML.fromHTML() 带有图像?
Here:
http://developer.android.com/reference/android/text/Html.html
in description of public static Spanned fromHtml (String source)
it says:
"Returns displayable styled text from the provided HTML string. Any tags in the HTML will display as a generic replacement image which your program can then go through and replace with real images."
So, you are getting the what you are supposed to get from this method, if you need to get whole images have a look at: Android HTML.fromHTML() with images?