0

我使用 GWT 2.1.1

在包resources中,我有 png 图像和一个 css 文件。

在css文件中我写道:

.finishedTask {
    background: white url("tick64.png") center center;
    padding: 0.5em;
    border: 0;
}

.unFinishedTask {
    background-color: white;
    padding: 0.5em;
    border: 0;
}

比我创建 ClientBundle 接口扩展。有了这个 CSS 和图像。

比在 UiBunder 视图中我尝试更改 css 样式:

    textArea.setStyleName(isFinished() ? res.style().finishedTask() : 
res.style().unFinishedTask());

当此代码执行时 textArea 的 css 布局被破坏,但我看到它发生了class变化(FireBug)。似乎是css中的错误。

也许有人已经尝试过做同样的事情。

4

1 回答 1

2

可能您应该使用addStyleNameaddStyleDependentName而不是setStyleName删除现有样式。

于 2011-01-29T19:22:56.267 回答