6

我需要在 GWT 的 UiBinder 中将许多分离的 CSS 类应用到 1 个元素中,但不知道该怎么做。

在我的 TestView.ui.xml 中,我有

<g:Button  text="Log Out"  ui:field="logoutButton" addStyleNames="{style.gwt-Button}" addStyleNames="{style.paddedRight}" />

但它产生了运行时错误。

然后我尝试了

<g:Button  text="Log Out"  ui:field="logoutButton" addStyleNames="{style.gwt-Button style.paddedRight}" />

这次我得到了编译时错误。

那么,如何在 GWT 的 UiBinder 中将样式名称“多个 css 类”添加到 1 个元素中?

在互联网上没有找到任何信息。

4

2 回答 2

14

我认为您必须addStyleNames在单独的括号对中指定属性中的每个样式名称。

像这样的东西:

<g:Button  text="Log Out"  ui:field="logoutButton" addStyleNames="{style.gwt-Button} {style.paddedRight}" />
于 2013-09-19T05:13:13.297 回答
0

此处的文档示例使用单引号。

<g:PushButton addStyleNames='{style.pretty} {style.hot}'>Push my hot button!</g:PushButton> 

双引号在我的应用程序中不起作用(GWT 2.6)

于 2015-05-14T16:23:00.953 回答