我刚刚开始探索 GWT,我对将样式应用于 GWT 小部件的不同方式有点困惑。在 gwt 文档中,有 4 种方法可以覆盖小部件的默认样式,
1) 在主机 HTML 页面中使用标签。(不推荐使用)2) 使用模块 XML 文件中的元素。(不推荐使用)3) 使用包含在 ClientBundle 中的 CssResource。4) 在 UiBinder 模板中使用内联元素。
假设我在某个包中有一个 CSS 文件,例如 com.abc.xyz.styles.css 。该文件具有以下内容,
/**the panel itself**/
.gwt-TabLayoutPanel {
border: none;
margin: 0px;
padding: 0px;
}
/**the tab bar element**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTabs {
background-color: #F4F4F4 !important;
}
/**an individual tab**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTab {
background-color: #6F6F6E !important;
}
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTab-selected {
background-color: white !important;
}
/**an element nested in each tab (useful for styling)**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTabInner {
font-family: Arial !important;
}
/**applied to all child content widgets**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelContent {
border: none;
margin: 0px;
overflow: hidden;
padding: 15px;
}
我将如何注入这个 css 文件?如何使用上述样式的第 3 和第 4 选项来完成此操作?