GWT UiBinder and Image Sprites

不羁的心 提交于 2019-12-05 18:39:02

You have to call ensureInjected() on your CssResource somewhere in your code; either:

POWResources.INSTANCE.sprites().ensureInjected();

or

@UiField POWResources resources;
…
resources.sprites().ensureInjected();

Alternatively, if you don't share the styles/images with other code, you can replace your ClientBundle with the implicit one that UiBinder creates from ui:style and ui:image (and UiBinder will then take care of calling ensureInjected for you):

<ui:style>
  @sprite .underMenuGlow {gwt-image: "underTopGlow"}
</ui:style>
<ui:image field="underTopGlow" src="site1/undertopglow.png" />
…
<span class="{style.underMenuGlow}">foo</span>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!