【发布时间】:2011-12-17 09:17:42
【问题描述】:
我有一个大的 SimpleLayoutPanel,它位于 RootLayoutPanel.get() 中,这是一个约束。
现在我想放置一些额外的面板并希望它具有位置:固定在浏览器屏幕中。有可能吗?
我既不能用 setStyleName()/CSS 也不能用 DOM.setStyleAttribute() 来设置这个样式。在这两种情况下,我的风格都被 GWT 所取代
谢谢
我成功的代码
我同时使用了两个根面板
public void onModuleLoad() {
SimpleLayoutPanel simpleLayoutPanel = new SimpleLayoutPanel();
simpleLayoutPanel.setStyleName("SimpleLayoutPanel");
DOM.setStyleAttribute(simpleLayoutPanel.getElement(), "backgroundColor", "blue");
RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
rootLayoutPanel.add(simpleLayoutPanel);
LayoutPanel layoutPanel = new LayoutPanel();
layoutPanel.setStyleName("LayoutPanel");
DOM.setStyleAttribute(layoutPanel.getElement(), "position", "fixed");
DOM.setStyleAttribute(layoutPanel.getElement(), "bottom", "0px");
DOM.setStyleAttribute(layoutPanel.getElement(), "height", "100px");
DOM.setStyleAttribute(layoutPanel.getElement(), "width", "100px");
DOM.setStyleAttribute(layoutPanel.getElement(), "backgroundColor", "red");
RootPanel rootPanel = RootPanel.get();
rootPanel.add(layoutPanel);
}
【问题讨论】:
标签: java gwt position panel fixed