gpt4 book ai didi

gwt - 如何在gwt uibinder中添加图像

转载 作者:行者123 更新时间:2023-12-02 04:29:01 24 4
gpt4 key购买 nike

我在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com