作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 gwt 中有一个 UIBinder java 类,其中包含一个带有一些文本的标签,例如
Label img = new Label();
img.setText("<img src=h.png></img>") or some other Html tag like div
并在 HTMLPanel 中添加此标签
HTMLPanel html = new HTMLPanel;
html.add(img,"img");
现在我在 uibinder xml 中有一个表,例如
<table align="center" cellspacing="20px">
<tr>
<td>image</td>
<td id="image"></td>
</tr>
<table>
但是我在这里得到一个字符串
"<img src=h.png></img>"
不是图片,请有人帮助我..
最佳答案
如果您需要图像,则无需使用标签小部件。如果您使用 ImageResource,您可以执行以下操作:
// Link to your ClientBundle with ImageResource methods
<ui:with type="com.myPackage.client.icons.Icons" field="icon" />
<g:Image ui:field="myImage" resource="{icon.myImage}" />
如果您不需要此图像执行任何操作,那么您可以简单地使用常规 HTML:
<g:HTMLPanel>
<img src="h.png" />
</g:HTMLPanel>
关于gwt - 如何在gwt uibinder中添加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24670885/
我是一名优秀的程序员,十分优秀!