有没有一种方法可以编辑一个自定义的css类来启用这些css样式规则http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/MenuBar.html
我现在通过以下代码创建了我的MenuBar:
MenuBar menuButton = new MenuBar();
menuButton.addStyleName(masterPanel.getmenuBar());
使用接口获取css类:
interface Style extends CssResource {
String menuBar();
String action();
}
我有一个css类,只能编辑我的菜单栏:
.menuBar {
cursor: default;
text-align: center;
background: transparent;
border: none;
color: white;
text-shadow: none;
font-size: 16px;
}
有没有一种方法我可以访问样式,比如:
.gwt-MenuBar-horizontal
.gwt-MenuBar-vertical
.gwt-MenuBar .gwt-MenuItem
.gwt-MenuBar .gwt-MenuItem-selected
.gwt-MenuBar .gwt-MenuItemSeparator
.gwt-MenuBar .gwt-MenuItemSeparator .menuSeparatorInner
.gwt-MenuBarPopup .menuPopupTopLeft
首先,我将您的css片段添加到项目的.css中,并使用menuButton.setStyleName("menuBar")
将其添加到菜单栏中。然后,我将以下内容添加到项目css类中(作为示例(:
.gwt-MenuItem-selected
{
color:red !important;
}
现在,第一个菜单栏样式已启用,附加样式也已设置。有必要使用!重要的是要覆盖默认属性。